Skip to content

Commit 0425ad5

Browse files
committed
added support of fetching env from ci
1 parent e1b3c08 commit 0425ad5

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

commands/utils/set_args.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -456,13 +456,20 @@ function sync_args_from_cmd(args) {
456456
}
457457
}
458458
}
459-
460459
if (dot_env_keys_list) {
461460
try {
462461
for (index in dot_env_keys_list) {
463462
let envKey = dot_env_keys_list[index]
464-
let envValue = parsedEnv[envKey]
465-
envs[envKey] = envValue
463+
if (parsedEnv && parsedEnv[envKey]) {
464+
let envValue = parsedEnv[envKey]
465+
envs[envKey] = envValue
466+
console.log(`Setting custom key ${envKey} from .env file`)
467+
} else if (process.env[envKey]){
468+
envs[envKey] = process.env[envKey]
469+
console.log(`Setting custom key ${envKey} from environment`)
470+
} else {
471+
console.error(`value of ${envKey} is not found in .env file or environment variable`)
472+
}
466473
}
467474
} catch (err) {
468475
console.error("error in fetching environment variables from .env file",err);

commands/utils/validate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ module.exports = validate_config = function (lt_config, validation_configs) {
381381
);
382382
}
383383
if (envValue == undefined || envValue === "") {
384-
reject("Value of environment variable cannot be left blank");
384+
reject(`Value of environment variable ${envKey} cannot be left blank`);
385385
}
386386
});
387387
}

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ const argv = require("yargs")
160160
})
161161
.option("sys-env-keys", {
162162
alias: "sys-env-keys",
163-
describe: "system environment variables from .env file",
163+
describe: "system environment variables from .env file and os environment",
164164
type: "string",
165165
})
166166
.option("envfl", {

0 commit comments

Comments
 (0)