mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-07 06:25:50 +01:00
fixed #1025
This commit is contained in:
11
app.js
11
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();
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user