mirror of
https://github.com/usebruno/bruno.git
synced 2024-11-24 17:03:47 +01:00
Merge pull request #207 from mirkogolze/feature/env-secrets
#199 improve code to check given env vars correctly
This commit is contained in:
commit
eaa31342dc
@ -193,17 +193,18 @@ const handler = async function (argv) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (processVars && Array.isArray(processVars)) {
|
if (processVars && Array.isArray(processVars)) {
|
||||||
processVars.forEach((value) => {
|
for (const value of processVars.values()) {
|
||||||
let parts = value.split('=');
|
// split the string at the first equals sign
|
||||||
if (parts.length !== 2) {
|
const match = value.match(/^([^=]+)=(.*)$/);
|
||||||
|
if (!match) {
|
||||||
console.error(
|
console.error(
|
||||||
chalk.red(`overridable environment variable not correct: use name=value - presented: `) +
|
chalk.red(`Overridable environment variable not correct: use name=value - presented: `) +
|
||||||
chalk.dim(`${value}`)
|
chalk.dim(`${value}`)
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
envVars[parts[0]] = parts[1];
|
envVars[match[1]] = match[2];
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user