From 2c1978218c957aba8f60a189097694bf1de25b0f Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Tue, 1 Apr 2014 16:35:44 -0400 Subject: [PATCH] moving the db require to where it is actually needed --- src/install.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/install.js b/src/install.js index b2e799c33f..795656d8f1 100644 --- a/src/install.js +++ b/src/install.js @@ -8,7 +8,6 @@ var async = require('async'), winston = require('winston'), nconf = require('nconf'), utils = require('../public/src/utils.js'), - db = require('./database.js'), install = { questions: [{ @@ -329,7 +328,8 @@ var async = require('async'), }, function (next) { // Default plugins - var Plugins = require('./plugins'); + var Plugins = require('./plugins'), + db = require('./database.js'); winston.info('Enabling default plugins'); @@ -350,7 +350,11 @@ var async = require('async'), }, next); }, function (next) { - db.setObjectField('widgets:global', 'footer', "[{\"widget\":\"html\",\"data\":{\"html\":\"\",\"title\":\"\",\"container\":\"\"}}]", next); + var db = require('./src/database').init(function(err) { + if (!err) { + db.setObjectField('widgets:global', 'footer', "[{\"widget\":\"html\",\"data\":{\"html\":\"\",\"title\":\"\",\"container\":\"\"}}]", next); + } + }); }, function (next) { require('./upgrade').upgrade(next);