Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

added API_ORIGINS support

Blue Mouse9f9403d4bec8
diff --git a/.env.example b/.env.example
index c67f00841..64f083c8c 100644
--- a/.env.example
+++ b/.env.example
@@ -15,6 +15,8 @@ CLICKHOUSE_USER=default
CLICKHOUSE_PORT=8123
CLICKHOUSE_PASSWORD=password
CLICKHOUSE_DATABASE=analytics
+# Leave empty for all origins
+API_ORIGINS=
# Payments
STRIPE_SECRET=sk_liveortest_yourstripesecretkey513
diff --git a/Dockerfile b/Dockerfile
index 72bf9e8c9..3f7b82781 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -21,6 +21,7 @@ ENV TZ=UTC \
CLICKHOUSE_PORT=8123 \
CLICKHOUSE_PASSWORD=password \
CLICKHOUSE_DATABASE=analytics \
+ API_ORIGINS=\
PASSWORD=12345678 \
SMTP_MOCK=true \
diff --git a/src/main.ts b/src/main.ts
index 0d705bbf4..65008b7b0 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -8,7 +8,9 @@ import { AppModule } from './app.module'
async function bootstrap() {
const app = await NestFactory.create(AppModule)
- app.enableCors()
+ app.enableCors({
+ origin: process.env.API_ORIGINS || undefined
+ })
app.use(cookieParser())
app.useGlobalPipes(new ValidationPipe())