make isPrimary and isCluster always booleans
they were strings when using ./nodebb start and boolean if they were in config.json and started with node app.js
This commit is contained in:
Barış Soner Uşaklı
2020-07-07 20:13:14 -04:00
parent 8853cd1aa5
commit c2ca02dfc7
10 changed files with 34 additions and 36 deletions

View File

@@ -39,9 +39,9 @@ const urlObject = url.parse(nconf.get('url'));
const relativePath = urlObject.pathname !== '/' ? urlObject.pathname : '';
nconf.set('relative_path', relativePath);
if (!nconf.get('isCluster')) {
nconf.set('isPrimary', 'true');
nconf.set('isCluster', 'true');
if (nconf.get('isCluster') === undefined) {
nconf.set('isPrimary', true);
nconf.set('isCluster', true);
}
const dbType = nconf.get('database');

View File

@@ -8,7 +8,7 @@ var pubsub = require('../src/pubsub');
describe('pubsub', function () {
it('should use the plain event emitter', function (done) {
nconf.set('isCluster', 'false');
nconf.set('isCluster', false);
pubsub.reset();
pubsub.on('testEvent', function (message) {
assert.equal(message.foo, 1);
@@ -21,7 +21,7 @@ describe('pubsub', function () {
it('should use same event emitter', function (done) {
pubsub.on('dummyEvent', function (message) {
assert.equal(message.foo, 2);
nconf.set('isCluster', 'true');
nconf.set('isCluster', true);
pubsub.removeAllListeners('dummyEvent');
pubsub.reset();
done();