From 4582d8694fff5eff572b3086c401e6c4bada7ef2 Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 20 Jul 2018 22:28:08 +1000 Subject: [PATCH] Removed settings file --- SettingsHelper.js | 25 +++++++++++-------------- config/prod.env.js | 2 ++ 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/SettingsHelper.js b/SettingsHelper.js index 1853d11c..0ebdd7ed 100644 --- a/SettingsHelper.js +++ b/SettingsHelper.js @@ -1,7 +1,14 @@ -var jsonfile = require('jsonfile') const args = require('args-parser')(process.argv) - +const defaults = { + 'webroot': '', + 'serverroot': '', + 'accessUrl': '', + 'autoJoin': false, + 'autoJoinServer': '', + 'autoJoinRoom': '', + 'autoJoinPassword': '' +} module.exports = function () { const fields = [ 'webroot', @@ -12,21 +19,11 @@ module.exports = function () { 'autoJoinRoom', 'autoJoinPassword' ] - // Load and export our settings in preference of ENV -> settings.json -> example_settings.json + // Load and export our settings in preference of ENV -> args let output = {} - let settingsFile - try { - settingsFile = require('./settings.json') - } catch (e) { - console.log('Creating default settings.json') - let defaults = require('./example_settings.json') - jsonfile.writeFileSync('./settings.json', defaults) - settingsFile = defaults - } - let defaults = require('./example_settings.json') for (let i = 0; i < fields.length; i++) { let setting = fields[i] - output[setting] = args[setting] || process.env[setting] || settingsFile[setting] || defaults[setting] + output[setting] = args[setting] || process.env[setting] || defaults[setting] } return output } diff --git a/config/prod.env.js b/config/prod.env.js index ed9355d9..f54c16b9 100644 --- a/config/prod.env.js +++ b/config/prod.env.js @@ -1,5 +1,7 @@ var git = require('git-rev-sync') +console.log('Production env', process.env) + module.exports = { NODE_ENV: '"production"', gitHash: '"' + git.short() + '"',