From 58f0324a7bf642b21d113c282b7f7a93bd6bd5ab Mon Sep 17 00:00:00 2001 From: Frode Jensen Date: Wed, 23 Oct 2019 13:38:53 +0200 Subject: [PATCH] feat(env): Use dotenv for app as well as build. Included dotenv in app as it allows easier setup of environments without having to remember runtime arguments. Also keeps secrets out of the shell history. --- modules/utils/setEnv.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/utils/setEnv.js b/modules/utils/setEnv.js index 60c15d95..1cebd297 100644 --- a/modules/utils/setEnv.js +++ b/modules/utils/setEnv.js @@ -1,4 +1,5 @@ const argv = require('minimist')(process.argv.slice(2)); +require('dotenv').config(); const { _, ...flags } = argv; @@ -7,8 +8,7 @@ Object.keys(flags || {}).map(key => { process.env[key] = value; }); -process.env.ENABLE_CLOUDFLARE = - flags.ENABLE_CLOUDFLARE === 'true' ? true : false; +process.env.ENABLE_CLOUDFLARE = !!process.env.ENABLE_CLOUDFLARE; export default function() { return _;