Skip to content

Node.js based forum software built for the modern web

fixed #1025

Julian Lamd933e81b3791
diff --git a/app.js b/app.js
index 18d7757a82..58390f1930 100644
--- a/app.js
+++ b/app.js
@@ -62,10 +62,17 @@ winston.info('This program comes with ABSOLUTELY NO WARRANTY.');
winston.info('This is free software, and you are welcome to redistribute it under certain conditions.');
winston.info('');
+// Alternate configuration file support
+var configFile = __dirname + '/config.json',
+ configExists;
+if (nconf.get('config')) {
+ configFile = path.join(__dirname, nconf.get('config'));
+}
+configExists = fs.existsSync(configFile);
-if (!nconf.get('help') && !nconf.get('setup') && !nconf.get('install') && !nconf.get('upgrade') && fs.existsSync(__dirname + '/config.json')) {
+if (!nconf.get('help') && !nconf.get('setup') && !nconf.get('install') && !nconf.get('upgrade') && configExists) {
start();
-} else if (nconf.get('setup') || nconf.get('install') || !fs.existsSync(__dirname + '/config.json')) {
+} else if (nconf.get('setup') || nconf.get('install') || !configExists) {
setup();
} else if (nconf.get('upgrade')) {
upgrade();
diff --git a/src/install.js b/src/install.js
index 6e4c4ae876..14d368c422 100644
--- a/src/install.js
+++ b/src/install.js
@@ -447,10 +447,15 @@ var async = require('async'),
}
},
save: function (server_conf, client_conf, callback) {
+ var serverConfigPath = path.join(__dirname, '../config.json');
+ if (nconf.get('config')) {
+ serverConfigPath = path.join(__dirname, '../', nconf.get('config'));
+ }
+
// Server Config
async.parallel([
function (next) {
- fs.writeFile(path.join(__dirname, '../', 'config.json'), JSON.stringify(server_conf, null, 4), function (err) {
+ fs.writeFile(serverConfigPath, JSON.stringify(server_conf, null, 4), function (err) {
next(err);
});
},