From 50086ac8da28b13d490979c0452860d243d61a46 Mon Sep 17 00:00:00 2001 From: Niko Sams Date: Mon, 16 Mar 2026 08:59:19 +0100 Subject: [PATCH] Demo: remove SITE_URL (and BREVO_REDIRECT_URL_FOR_IMPORT) from env As we don't have a single site url that variable should not be used, as it only points to the first site. Use siteConfig instead. Also remove BREVO_REDIRECT_URL_FOR_IMPORT and get the url from siteConfig - for the correct one. --- .env | 2 -- demo/api/src/app.module.ts | 19 +++++++------------ demo/api/src/config/config.ts | 1 - demo/api/src/config/environment-variables.ts | 3 --- package.json | 2 +- 5 files changed, 8 insertions(+), 19 deletions(-) diff --git a/.env b/.env index 893313d3292..7cbaceaea6b 100644 --- a/.env +++ b/.env @@ -81,7 +81,6 @@ IDP_END_SESSION_ENDPOINT=http://${DEV_DOMAIN:-localhost}:${IDP_PORT}/session/end # site SITE_PORT=3000 -SITE_URL=http://${DEV_DOMAIN:-localhost}:$SITE_PORT SITE_PRELOGIN_ENABLED=false SITE_PRELOGIN_PASSWORD=password NEXT_PUBLIC_SITE_DOMAIN=main @@ -124,7 +123,6 @@ OAUTH2_PROXY_SKIP_AUTH_PREFLIGHT=true # brevo BREVO_API_KEY= # set in demo/.env.local BREVO_ECG_RTR_LIST_API_KEY= # set in demo/.env.local -BREVO_REDIRECT_URL_FOR_IMPORT=$SITE_URL BREVO_CAMPAIGN_BASIC_AUTH_USERNAME= BREVO_CAMPAIGN_BASIC_AUTH_PASSWORD= BREVO_EMAIL_HASH_KEY=JJgGFeXBBAfd4pT8vn4ZtKeXE2EpsmwhoH9hfxhToBBvi2bVtR2gfBbWH2UVa8aa diff --git a/demo/api/src/app.module.ts b/demo/api/src/app.module.ts index 9f5df3a635a..d0a110e70c9 100644 --- a/demo/api/src/app.module.ts +++ b/demo/api/src/app.module.ts @@ -235,19 +235,14 @@ export class AppModule { resolveConfig: (scope: EmailCampaignContentScope) => { // change config based on scope - for example different sender email // this is just to show you can use the scope to change the config but it has no real use in this example - if (scope.domain === "main") { - return { - apiKey: config.brevo.apiKey, - redirectUrlForImport: config.brevo.redirectUrlForImport, - }; - } else if (scope.domain === "secondary") { - return { - apiKey: config.brevo.apiKey, - redirectUrlForImport: config.brevo.redirectUrlForImport, - }; + const siteConfig = config.siteConfigs.find((siteConfig) => siteConfig.scope.domain == scope.domain); + if (!siteConfig) { + throw Error("Invalid scope passed"); } - - throw Error("Invalid scope passed"); + return { + apiKey: config.brevo.apiKey, + redirectUrlForImport: siteConfig.url, + }; }, BlacklistedContacts, BrevoContactAttributes, diff --git a/demo/api/src/config/config.ts b/demo/api/src/config/config.ts index aff1f9cfeb8..f4873f2ed53 100644 --- a/demo/api/src/config/config.ts +++ b/demo/api/src/config/config.ts @@ -115,7 +115,6 @@ export function createConfig(processEnv: NodeJS.ProcessEnv) { siteConfigs: envVars.PRIVATE_SITE_CONFIGS, brevo: { apiKey: envVars.BREVO_API_KEY, - redirectUrlForImport: envVars.BREVO_REDIRECT_URL_FOR_IMPORT, campaign: { basicAuth: { username: envVars.BREVO_CAMPAIGN_BASIC_AUTH_USERNAME, diff --git a/demo/api/src/config/environment-variables.ts b/demo/api/src/config/environment-variables.ts index 58489f21cc7..fbec2b9028a 100644 --- a/demo/api/src/config/environment-variables.ts +++ b/demo/api/src/config/environment-variables.ts @@ -192,9 +192,6 @@ export class EnvironmentVariables { @IsString() BREVO_API_KEY: string; - @IsString() - BREVO_REDIRECT_URL_FOR_IMPORT: string; - @IsString() BREVO_ECG_RTR_LIST_API_KEY: string; diff --git a/package.json b/package.json index 537eef43fc9..7cbe7d830ce 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "browser:demo": "run-p browser:demo:api browser:demo:admin browser:demo:site browser:demo:jaeger", "browser:demo:api": "dotenv -- sh -c 'open-cli $API_URL/graphql'", "browser:demo:admin": "dotenv -- sh -c 'open-cli $ADMIN_URL'", - "browser:demo:site": "dotenv -- sh -c 'open-cli $SITE_URL'", + "browser:demo:site": "dotenv -- sh -c 'open-cli http://localhost:$SITE_PORT'", "browser:demo:jaeger": "dotenv -- sh -c 'open-cli http://localhost:$JAEGER_UI_PORT'", "install-agent-skills": "pnpm exec comet install-agent-skills --config agent-skills.json", "setup:ci": "pnpm run copy-project-files",