removed filterBannedPosts method that seemed unused -- monkey-patching

install script to remember old values (if present, otherwise use defaults)
v1.18.x
Julian Lam 11 years ago
parent 7296b701fa
commit 5a96f5f64b

@ -121,6 +121,10 @@
winston.warn('Configuration not found, starting NodeBB setup'); winston.warn('Configuration not found, starting NodeBB setup');
} }
nconf.file({
file: __dirname + '/config.json'
});
var install = require('./src/install'); var install = require('./src/install');
winston.info('Welcome to NodeBB!'); winston.info('Welcome to NodeBB!');

@ -12,44 +12,44 @@ var async = require('async'),
questions: [{ questions: [{
name: 'base_url', name: 'base_url',
description: 'URL of this installation', description: 'URL of this installation',
'default': 'http://localhost', 'default': nconf.get('base_url') || 'http://localhost',
pattern: /^http(?:s)?:\/\//, pattern: /^http(?:s)?:\/\//,
message: 'Base URL must begin with \'http://\' or \'https://\'', message: 'Base URL must begin with \'http://\' or \'https://\'',
}, { }, {
name: 'port', name: 'port',
description: 'Port number of your NodeBB', 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]/, 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' message: 'Please enter a value betweeen 1 and 65535'
}, { }, {
name: 'use_port', name: 'use_port',
description: 'Use a port number to access NodeBB?', description: 'Use a port number to access NodeBB?',
'default': 'y', 'default': (nconf.get('use_port') ? 'y' : 'n') || 'y',
pattern: /y[es]*|n[o]?/, pattern: /y[es]*|n[o]?/,
message: 'Please enter \'yes\' or \'no\'', message: 'Please enter \'yes\' or \'no\'',
}, { }, {
name: 'secret', name: 'secret',
description: 'Please enter a NodeBB secret', description: 'Please enter a NodeBB secret',
'default': utils.generateUUID() 'default': nconf.get('secret') || utils.generateUUID()
}, { }, {
name: 'redis:host', name: 'redis:host',
description: 'Host IP or address of your Redis instance', 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', name: 'redis:port',
description: 'Host port of your Redis instance', description: 'Host port of your Redis instance',
'default': 6379 'default': nconf.get('redis:port') || 6379
}, { }, {
name: 'redis:password', name: 'redis:password',
description: 'Password of your Redis database' description: 'Password of your Redis database'
}, { }, {
name: "redis:database", name: "redis:database",
description: "Which database to use (0..n)", description: "Which database to use (0..n)",
'default': 0 'default': nconf.get('redis:database') || 0
}, { }, {
name: 'bind_address', name: 'bind_address',
description: 'IP or Hostname to bind to', description: 'IP or Hostname to bind to',
'default': '0.0.0.0' 'default': nconf.get('bind_address') || '0.0.0.0'
}], }],
setup: function (callback) { setup: function (callback) {
async.series([ async.series([

@ -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? // TODO: this function is never called except from some debug route. clean up?
Posts.getPostData = function(pid, callback) { Posts.getPostData = function(pid, callback) {
RDB.hgetall('post:' + pid, function(err, data) { RDB.hgetall('post:' + pid, function(err, data) {
@ -146,8 +140,9 @@ var RDB = require('./redis.js'),
if (!err) callback(newData); if (!err) callback(newData);
else callback(data); else callback(data);
}); });
} else } else {
console.log(err); winston.error(err);
}
}); });
} }

Loading…
Cancel
Save