From 3a1649c5ce11bafd56fe9519148a8c880b276c68 Mon Sep 17 00:00:00 2001 From: Jack Allnutt Date: Mon, 24 Nov 2014 15:39:47 +0000 Subject: [PATCH] Split checking for config file location into helper file. --- server/build.js | 19 ++++--------------- server/kiwi.js | 14 ++------------ 2 files changed, 6 insertions(+), 27 deletions(-) diff --git a/server/build.js b/server/build.js index 22ecf79..040e979 100644 --- a/server/build.js +++ b/server/build.js @@ -36,21 +36,10 @@ function concat(file_list, callback) { -// Load the config, using -c argument if available -(function (argv) { - var conf_switch = argv.indexOf('-c'); - if (conf_switch !== -1) { - if (argv[conf_switch + 1]) { - return config.loadConfig(argv[conf_switch + 1]); - } - } - - config.loadConfig(); - -})(process.argv); - - - +if (!require('./helpers/configloader.js')()) { + console.error('Couldn\'t find a valid config.js file (Did you copy the config.example.js file yet?)'); + process.exit(1); +} var source_files = [ global.config.public_http + '/src/app.js', diff --git a/server/kiwi.js b/server/kiwi.js index 58df810..67e952b 100755 --- a/server/kiwi.js +++ b/server/kiwi.js @@ -16,18 +16,8 @@ process.chdir(__dirname + '/../'); // Get our own version from package.json global.build_version = require('../package.json').version; -// Load the config, using -c argument if available -(function (argv) { - var conf_switch = argv.indexOf('-c'); - if (conf_switch !== -1) { - if (argv[conf_switch + 1]) { - return config.loadConfig(argv[conf_switch + 1]); - } - } - - config.loadConfig(); - -})(process.argv); +// Load the configuration +require('./helpers/configloader.js')(); // If we're not running in the forground and we have a log file.. switch -- 2.25.1