diff --git a/app.js b/app.js index 292b599335..73b5f7c3c0 100644 --- a/app.js +++ b/app.js @@ -63,9 +63,7 @@ if (nconf.get('config')) { } configExists = fs.existsSync(configFile); -if (!nconf.get('setup') && !nconf.get('install') && !nconf.get('upgrade') && !nconf.get('reset') && configExists) { - start(); -} else if (nconf.get('setup') || nconf.get('install')) { +if (nconf.get('setup') || nconf.get('install')) { setup(); } else if (!configExists) { require('./install/web').install(nconf.get('port')); @@ -73,6 +71,10 @@ if (!nconf.get('setup') && !nconf.get('install') && !nconf.get('upgrade') && !nc upgrade(); } else if (nconf.get('reset')) { reset(); +} else if (nconf.get('activate')) { + activate(); +} else { + start(); } function loadConfig() { @@ -280,6 +282,17 @@ function upgrade() { }); } +function activate() { + loadConfig(); + + require('./src/database').init(function(err) { + var plugin = nconf.get('activate'), + db = require('./src/database'); + + db.sortedSetAdd('plugins:active', plugin, 1, start); + }); +} + function reset() { loadConfig(); diff --git a/nodebb b/nodebb index d19833d010..4a94680fc3 100755 --- a/nodebb +++ b/nodebb @@ -115,6 +115,16 @@ switch(process.argv[2]) { }); break; + case 'activate': + var args = process.argv.slice(0); + args.unshift('--activate'); + + cproc.fork('app.js', args, { + cwd: __dirname, + silent: false + }); + break; + case 'upgrade': async.series([ function(next) {