fix(cloudcmd) env variables override (#179)

This commit is contained in:
coderaiser 2018-06-21 17:51:15 +03:00
parent 5592e9dba5
commit 1330acbf22
3 changed files with 13 additions and 2 deletions

View file

@ -10,7 +10,7 @@ const config = require(DIR_SERVER + 'config');
const env = require(DIR_SERVER + 'env');
const choose = (a, b) => {
if (!a)
if (a === undefined)
return b;
return a;

View file

@ -10,7 +10,8 @@ module.exports.bool = (name) => {
if (value === 'true')
return true;
return false;
if (value === 'false')
return false;
};
function parse(name) {

View file

@ -36,3 +36,13 @@ test('env: bool: true', (t) => {
t.end();
});
test('env: bool: undefined', (t) => {
const {cloudcmd_terminal} = process.env;
process.env.cloudcmd_terminal = undefined;
t.equal(env.bool('terminal'), undefined, 'should be undefined');
process.env.cloudcmd_terminal = cloudcmd_terminal;
t.end();
});