move env consolidation after loading envFile#935
move env consolidation after loading envFile#935ramya-rao-a merged 4 commits intomicrosoft:masterfrom
Conversation
|
@goenning, |
| if (value.length > 0 && value.charAt(0) === '"' && value.charAt(value.length - 1) === '"') { | ||
| value = value.replace(/\\n/gm, '\n'); | ||
| } | ||
| env[r[1]] = value.replace(/(^['"]|['"]$)/g, ''); |
There was a problem hiding this comment.
Actually, just changing the env in this line to finalEnv should also do the trick. Can you try that?
There was a problem hiding this comment.
Or we can get rid of finalEnv altogether and instead just replace that with
env = Object.assign({}, process.env, env)
There was a problem hiding this comment.
Great idea! I was focusing only on getting it done 😄 Can you see how it looks now?
There was a problem hiding this comment.
By the way, I'm suggesting that we use the following precedence order
launch env -> file env -> process env so we can override file env values with launch specific values.
What do you think? Check the last commit.
src/debugAdapter/goDebug.ts
Outdated
| this.remotePath = remotePath; | ||
| let mode = launchArgs.mode; | ||
| let env = launchArgs.env || {}; | ||
| let env = Object.assign({}, launchArgs.env, process.env); |
There was a problem hiding this comment.
this way the process.env overrides launchArgs.env
It should be the other way around
There was a problem hiding this comment.
Check last commit, I changed it.
| if (value.length > 0 && value.charAt(0) === '"' && value.charAt(value.length - 1) === '"') { | ||
| value = value.replace(/\\n/gm, '\n'); | ||
| } | ||
| env[r[1]] = value.replace(/(^['"]|['"]$)/g, ''); |
|
great, thanks @goenning! |
Works fine for me after I moved this :)
Fixes #934