mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-24 03:05:41 +00:00
22 lines
416 B
JavaScript
22 lines
416 B
JavaScript
import snake from 'just-snake-case';
|
|
|
|
const {env} = process;
|
|
const up = (a) => a.toUpperCase();
|
|
|
|
export default function parse(name) {
|
|
const small = `cloudcmd_${snake(name)}`;
|
|
const big = up(small);
|
|
|
|
return env[big] || env[small];
|
|
}
|
|
|
|
parse.bool = (name) => {
|
|
const value = parse(name);
|
|
|
|
if (value === 'true')
|
|
return true;
|
|
|
|
if (value === 'false')
|
|
return false;
|
|
};
|
|
|