From a48c914a165db28fba1f25634c0654597e3a5e7e Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Wed, 8 Feb 2017 11:23:27 -0500 Subject: [PATCH] explicitly cast jobsDisabled as Boolean --- app.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app.js b/app.js index 77da25936d..de5642e515 100644 --- a/app.js +++ b/app.js @@ -117,6 +117,17 @@ function loadConfig(callback) { nconf.set('url_parsed', url.parse(nconf.get('url'))); } + // Explicitly cast 'jobsDisabled' as Bool + var castAsBool = ['jobsDisabled']; + nconf.stores.env.readOnly = false; + castAsBool.forEach(function (prop) { + var value = nconf.get(prop); + if (value) { + nconf.set(prop, typeof value === 'boolean' ? value : String(value).toLowerCase() === 'true'); + } + }); + nconf.stores.env.readOnly = true; + if (typeof callback === 'function') { callback(); }