From ee6d97fd7f72117c8e4efe11e9bec6e0212174ad Mon Sep 17 00:00:00 2001 From: Jonathan Tsai Date: Tue, 29 Dec 2020 02:26:27 +0000 Subject: [PATCH] conditionally load dotenv --- server.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/server.js b/server.js index e79dcd0..8558b6f 100644 --- a/server.js +++ b/server.js @@ -1,5 +1,3 @@ -require('dotenv').config(); - var http = require('http'); var fs = require('fs'); @@ -18,6 +16,10 @@ const config = JSON.parse(fs.readFileSync(configPath, 'utf8')); config.port = process.env.PORT || config.port || 7777; config.host = process.env.HOST || config.host || 'localhost'; +if (config.dotEnv) { + require('dotenv').config(); +} + // Set up the logger if (config.logging) { try {