fix(env) UPPER_CASE first, and then lower_case (#283)

This commit is contained in:
coderaiser 2020-04-10 12:46:31 +03:00
parent 511e40fa72
commit 24ab06c005
2 changed files with 19 additions and 1 deletions

View file

@ -18,6 +18,6 @@ function parse(name) {
const small = `cloudcmd_${name}`;
const big = up(small);
return env[small] || env[big];
return env[big] || env[small];
}

18
server/env.spec.js Normal file
View file

@ -0,0 +1,18 @@
'use strict';
const test = require('supertape');
const env = require('./env');
test('cloudcmd: server: env: bool: upper case first', (t) => {
const {CLOUDCMD_TERMINAL} = process.env;
const {cloudcmd_terminal} = process.env;
process.env.cloudcmd_terminal = 'true';
process.env.CLOUDCMD_TERMINAL = 'false';
const result = env.bool('terminal');
t.notOk(result);
t.end();
});