summaryrefslogtreecommitdiff
path: root/src/node
diff options
context:
space:
mode:
authorMarcel Klehr <mklehr@gmx.net>2012-10-28 18:02:49 +0100
committerMarcel Klehr <mklehr@gmx.net>2012-10-28 18:02:49 +0100
commite447a6fade15ed2df53fef3e5845c134232306b8 (patch)
tree7ed65cc09e626842372f60d6464afa9259885968 /src/node
parentd5ace6c163ae6ec3789027c5301ae90beeb1f229 (diff)
downloadetherpad-lite-e447a6fade15ed2df53fef3e5845c134232306b8.zip
Make sure npm is initialized before requiring things (fix #1092)
Diffstat (limited to 'src/node')
-rwxr-xr-xsrc/node/server.js44
1 files changed, 31 insertions, 13 deletions
diff --git a/src/node/server.js b/src/node/server.js
index b91b0e17..327fa166 100755
--- a/src/node/server.js
+++ b/src/node/server.js
@@ -21,31 +21,49 @@
* limitations under the License.
*/
+var log4js = require('log4js')
+ , async = require('async')
+ ;
+
// set up logger
-var log4js = require('log4js');
log4js.replaceConsole();
-var settings = require('./utils/Settings');
-
-//set loglevel
-log4js.setGlobalLogLevel(settings.loglevel);
-
-var db = require('./db/DB');
-var async = require('async');
-var plugins = require("ep_etherpad-lite/static/js/pluginfw/plugins");
-var hooks = require("ep_etherpad-lite/static/js/pluginfw/hooks");
+var settings
+ , db
+ , plugins
+ , hooks;
var npm = require("npm/lib/npm.js");
-hooks.plugins = plugins;
-
async.waterfall([
+ // load npm
+ function(callback) {
+ npm.load({}, function(er) {
+ callback(er)
+ })
+ },
+
+ // load everything
+ function(callback) {
+ settings = require('./utils/Settings');
+ db = require('./db/DB');
+ plugins = require("ep_etherpad-lite/static/js/pluginfw/plugins");
+ hooks = require("ep_etherpad-lite/static/js/pluginfw/hooks");
+ hooks.plugins = plugins;
+
+ //set loglevel
+ log4js.setGlobalLogLevel(settings.loglevel);
+ callback();
+ },
+
//initalize the database
function (callback)
{
db.init(callback);
},
- plugins.update,
+ function(callback) {
+ plugins.update(callback)
+ },
function (callback) {
console.info("Installed plugins: " + plugins.formatPlugins());