diff --git a/app.js b/app.js index e8b662bbd4..2a4fb645ec 100644 --- a/app.js +++ b/app.js @@ -121,6 +121,10 @@ winston.warn('Configuration not found, starting NodeBB setup'); } + nconf.file({ + file: __dirname + '/config.json' + }); + var install = require('./src/install'); winston.info('Welcome to NodeBB!'); diff --git a/src/install.js b/src/install.js index 01a3806656..8541a0e15e 100644 --- a/src/install.js +++ b/src/install.js @@ -12,44 +12,44 @@ var async = require('async'), questions: [{ name: 'base_url', description: 'URL of this installation', - 'default': 'http://localhost', + 'default': nconf.get('base_url') || 'http://localhost', pattern: /^http(?:s)?:\/\//, message: 'Base URL must begin with \'http://\' or \'https://\'', }, { name: 'port', description: 'Port number of your NodeBB', - 'default': 4567, + 'default': nconf.get('port') || 4567, pattern: /[0-9]{1,4}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5]/, message: 'Please enter a value betweeen 1 and 65535' }, { name: 'use_port', description: 'Use a port number to access NodeBB?', - 'default': 'y', + 'default': (nconf.get('use_port') ? 'y' : 'n') || 'y', pattern: /y[es]*|n[o]?/, message: 'Please enter \'yes\' or \'no\'', }, { name: 'secret', description: 'Please enter a NodeBB secret', - 'default': utils.generateUUID() + 'default': nconf.get('secret') || utils.generateUUID() }, { name: 'redis:host', description: 'Host IP or address of your Redis instance', - 'default': '127.0.0.1' + 'default': nconf.get('redis:host') || '127.0.0.1' }, { name: 'redis:port', description: 'Host port of your Redis instance', - 'default': 6379 + 'default': nconf.get('redis:port') || 6379 }, { name: 'redis:password', description: 'Password of your Redis database' }, { name: "redis:database", description: "Which database to use (0..n)", - 'default': 0 + 'default': nconf.get('redis:database') || 0 }, { name: 'bind_address', description: 'IP or Hostname to bind to', - 'default': '0.0.0.0' + 'default': nconf.get('bind_address') || '0.0.0.0' }], setup: function (callback) { async.series([ diff --git a/src/posts.js b/src/posts.js index 06bac443b2..4c428e68fc 100644 --- a/src/posts.js +++ b/src/posts.js @@ -132,12 +132,6 @@ var RDB = require('./redis.js'), }); }; - Posts.filterBannedPosts = function(posts) { - return posts.filter(function(post) { - return post.user_banned === '0'; - }); - } - // TODO: this function is never called except from some debug route. clean up? Posts.getPostData = function(pid, callback) { RDB.hgetall('post:' + pid, function(err, data) { @@ -146,8 +140,9 @@ var RDB = require('./redis.js'), if (!err) callback(newData); else callback(data); }); - } else - console.log(err); + } else { + winston.error(err); + } }); }