diff --git a/.env b/.env index 6b77e0d6781..02c77ceda7f 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 API_BASIC_AUTH_SYSTEM_USER_PASSWORD=$BASIC_AUTH_SYSTEM_USER_PASSWORD SITE_PREVIEW_SECRET=zPoURKLHPcMnV7E9 @@ -122,7 +121,6 @@ OAUTH2_PROXY_SKIP_AUTH_PREFLIGHT=true # brevo BREVO_API_KEY= # set in .env.local BREVO_ECG_RTR_LIST_API_KEY= # set in .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 e57b94dced3..b670b76931e 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,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",