mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
fix(cloudcmd) env variables override (#179)
This commit is contained in:
parent
5592e9dba5
commit
1330acbf22
3 changed files with 13 additions and 2 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,8 @@ module.exports.bool = (name) => {
|
|||
if (value === 'true')
|
||||
return true;
|
||||
|
||||
return false;
|
||||
if (value === 'false')
|
||||
return false;
|
||||
};
|
||||
|
||||
function parse(name) {
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue