From aa88aa73a25123643ae9ccc9fb302c927cdf85ce Mon Sep 17 00:00:00 2001 From: Mirko Golze Date: Sun, 24 Sep 2023 15:28:33 +0200 Subject: [PATCH] #199 improve code to check given envvars correctly --- packages/bruno-cli/src/commands/run.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/bruno-cli/src/commands/run.js b/packages/bruno-cli/src/commands/run.js index 420eb696d..4b6aa3afa 100644 --- a/packages/bruno-cli/src/commands/run.js +++ b/packages/bruno-cli/src/commands/run.js @@ -193,17 +193,18 @@ const handler = async function (argv) { return; } if (processVars && Array.isArray(processVars)) { - processVars.forEach((value) => { - let parts = value.split('='); - if (parts.length !== 2) { + for (const value of processVars.values()) { + // split the string at the first equals sign + const match = value.match(/^([^=]+)=(.*)$/); + if (!match) { 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}`) ); return; } - envVars[parts[0]] = parts[1]; - }); + envVars[match[1]] = match[2]; + } } }