Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

move env consolidation after loading envFile #935

Merged
merged 4 commits into from
Apr 20, 2017

Conversation

goenning
Copy link
Contributor

@goenning goenning commented Apr 19, 2017

Works fine for me after I moved this :)
Fixes #934

@msftclas
Copy link

@goenning,
Thanks for having already signed the Contribution License Agreement. Your agreement was validated by Microsoft. We will now review your pull request.
Thanks,
Microsoft Pull Request Bot

@goenning goenning changed the title move env consolidation after loading envFile #934 move env consolidation after loading envFile Apr 19, 2017
if (value.length > 0 && value.charAt(0) === '"' && value.charAt(value.length - 1) === '"') {
value = value.replace(/\\n/gm, '\n');
}
env[r[1]] = value.replace(/(^['"]|['"]$)/g, '');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, just changing the env in this line to finalEnv should also do the trick. Can you try that?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or we can get rid of finalEnv altogether and instead just replace that with

env = Object.assign({}, process.env, env)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea! I was focusing only on getting it done 😄 Can you see how it looks now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed on the order.

@@ -181,7 +181,7 @@ class Delve {
this.program = program;
this.remotePath = remotePath;
let mode = launchArgs.mode;
let env = launchArgs.env || {};
let env = Object.assign({}, launchArgs.env, process.env);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this way the process.env overrides launchArgs.env
It should be the other way around

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, '');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed on the order.

@ramya-rao-a ramya-rao-a merged commit 5fab6f6 into microsoft:master Apr 20, 2017
@ramya-rao-a
Copy link
Contributor

great, thanks @goenning!

@goenning goenning deleted the fix-envfile branch April 20, 2017 06:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants