From 4ed70beabc73dd9aa1d2e06ab5902ded0801c404 Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Fri, 4 Mar 2022 16:49:41 +0100 Subject: chore: use a different configuration depending on app env It will be useful with Docker. Instead of cloning the project with a different configuration, I can manage two different configuration thanks to dotenv and some checking inside the app. --- next.config.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'next.config.js') diff --git a/next.config.js b/next.config.js index 077d0a0..fc35b57 100644 --- a/next.config.js +++ b/next.config.js @@ -1,7 +1,12 @@ const path = require('path'); -const backendDomain = process.env.APP_BACKEND_DOMAIN; -const frontendDomain = process.env.APP_FRONTEND_DOMAIN; +const isStaging = process.env.NEXT_PUBLIC_APP_ENV === 'staging'; +const backendDomain = isStaging + ? process.env.APP_STAGING_BACKEND_DOMAIN + : process.env.APP_BACKEND_DOMAIN; +const frontendDomain = isStaging + ? process.env.APP_STAGING_FRONTEND_DOMAIN + : process.env.APP_FRONTEND_DOMAIN; const ackeeDomain = process.env.NEXT_PUBLIC_ACKEE_DOMAIN; const contentSecurityPolicy = ` -- cgit v1.2.3