Skip to content

Commit

Permalink
Merge pull request #274 from HRanjan-11/CYP-875
Browse files Browse the repository at this point in the history
added support of fetching env from ci
  • Loading branch information
HRanjan-11 authored Nov 15, 2023
2 parents e1b3c08 + 6b733df commit 87074d8
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
13 changes: 10 additions & 3 deletions commands/utils/set_args.js
Original file line number Diff line number Diff line change
Expand Up @@ -456,13 +456,20 @@ function sync_args_from_cmd(args) {
}
}
}

if (dot_env_keys_list) {
try {
for (index in dot_env_keys_list) {
let envKey = dot_env_keys_list[index]
let envValue = parsedEnv[envKey]
envs[envKey] = envValue
if (parsedEnv && parsedEnv[envKey]) {
let envValue = parsedEnv[envKey]
envs[envKey] = envValue
console.log(`Setting custom key ${envKey} from .env file`)
} else if (process.env[envKey]){
envs[envKey] = process.env[envKey]
console.log(`Setting custom key ${envKey} from environment`)
} else {
console.error(`value of ${envKey} is not found in .env file or environment variable`)
}
}
} catch (err) {
console.error("error in fetching environment variables from .env file",err);
Expand Down
2 changes: 1 addition & 1 deletion commands/utils/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ module.exports = validate_config = function (lt_config, validation_configs) {
);
}
if (envValue == undefined || envValue === "") {
reject("Value of environment variable cannot be left blank");
reject(`Value of environment variable ${envKey} cannot be left blank`);
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ const argv = require("yargs")
})
.option("sys-env-keys", {
alias: "sys-env-keys",
describe: "system environment variables from .env file",
describe: "system environment variables from .env file and os environment in order",
type: "string",
})
.option("envfl", {
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lambdatest-cypress-cli",
"version": "3.0.20",
"version": "3.0.21",
"description": "The lambdatest-cypress-cli is LambdaTest's command-line interface (CLI) aimed to help you run your Cypress tests on LambdaTest platform.",
"homepage": "https://github.com/LambdaTest/lambdatest-cypress-cli",
"author": "LambdaTest <[email protected]>",
Expand Down

0 comments on commit 87074d8

Please sign in to comment.