v1.18.x
Julian Lam 11 years ago
parent 734d8f96e8
commit d933e81b37

@ -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);
});
},

Loading…
Cancel
Save