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. --- src/utils/config.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/utils/config.ts') diff --git a/src/utils/config.ts b/src/utils/config.ts index 5928f02..874a24c 100644 --- a/src/utils/config.ts +++ b/src/utils/config.ts @@ -1,9 +1,16 @@ +const isStaging = process.env.NEXT_PUBLIC_APP_ENV === 'staging'; + export const settings = { ackee: { filename: process.env.NEXT_PUBLIC_ACKEE_FILENAME || 'tracker.js', siteId: process.env.NEXT_PUBLIC_ACKEE_SITE_ID || '', url: `https://${process.env.NEXT_PUBLIC_ACKEE_DOMAIN}` || '', }, + api: { + url: isStaging + ? process.env.NEXT_PUBLIC_STAGING_GRAPHQL_API + : process.env.NEXT_PUBLIC_GRAPHQL_API, + }, name: 'Armand Philippot', baseline: { en: 'Front-end developer', @@ -20,5 +27,8 @@ export const settings = { }, postsPerPage: 10, twitterId: '@ArmandPhilippot', - url: `${process.env.NEXT_PUBLIC_APP_PROTOCOL}://${process.env.NEXT_PUBLIC_APP_DOMAIN}`, + url: + (isStaging + ? process.env.NEXT_PUBLIC_STAGING_APP_URL + : process.env.NEXT_PUBLIC_APP_URL) || '', }; -- cgit v1.2.3