Skip to content

Commit 87074d8

Browse files
authored
Merge pull request #274 from HRanjan-11/CYP-875
added support of fetching env from ci
2 parents e1b3c08 + 6b733df commit 87074d8

File tree

5 files changed

+15
-8
lines changed

5 files changed

+15
-8
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 in order",
164164
type: "string",
165165
})
166166
.option("envfl", {

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "lambdatest-cypress-cli",
3-
"version": "3.0.20",
3+
"version": "3.0.21",
44
"description": "The lambdatest-cypress-cli is LambdaTest's command-line interface (CLI) aimed to help you run your Cypress tests on LambdaTest platform.",
55
"homepage": "https://github.com/LambdaTest/lambdatest-cypress-cli",
66
"author": "LambdaTest <[email protected]>",

0 commit comments

Comments
 (0)