Skip to content

Commit

Permalink
Fix env variable to override the settings. Bug Fix for Docker
Browse files Browse the repository at this point in the history
  • Loading branch information
farajfarook committed Sep 20, 2020
1 parent 9ab2e98 commit 9634731
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ var session = require('express-session');
var async = require('async');
var moment = require('moment');
var fs = require('fs');
var lodash = require('lodash');

// Define routes
var indexRoute = require('./routes/index');
Expand Down Expand Up @@ -105,7 +106,12 @@ if(process.env.LOCALE) configApp.app.locale = process.env.LOCALE;
if(process.env.CONTEXT) configApp.app.context = process.env.CONTEXT;
if(process.env.MONITORING) configApp.app.monitoring = process.env.MONITORING;

if(!fs.existsSync(config_app)) fs.writeFileSync(config_app, JSON.stringify(configApp));
if (fs.existsSync(config_app)) {
let currentConfigApp = {}
try { currentConfigApp = JSON.parse(fs.readFileSync(config_app)) } catch (ex) { }
configApp = lodash.merge(currentConfigApp, configApp)
}
fs.writeFileSync(config_app, JSON.stringify(configApp));

// Check the env for a connection to initiate
var configConnection = {
Expand Down

0 comments on commit 9634731

Please sign in to comment.