question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Provide standardized way on how env variables override .env

See original GitHub issue

Environment data

  • VS Code version: 1.23.1
  • Extension version (available under the Extensions sidebar): 2018.4.0
  • OS and version: 10.12.6
  • Python version (& distribution if applicable, e.g. Anaconda): 3.6.5
  • Type of virtual environment used (N/A | venv | virtualenv | conda | …): venv

Actual behavior

envFile variables override launch.json env variables

Expected behavior

launch.json env variables override envFile variables

Steps to reproduce:

  • Define envFile with a variable
  • Define an env variable in launch.json with the same name
  • Run a script

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:6
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
WeetA34commented, May 11, 2020

Hello,

In official VSCode Debug Node.js documentation, we can see that env variables override envFile variables (Any environment variable specified in the env dictionary will override variables loaded from the file.).

In Python, it’s the opposite. I didn’t find something which describes the behavior in the documentation. It’s a bit confusing to have a different precedence compared to another language (ie. Node.js). Is-it possible, at least, to put the variables precedence described here in the documentation?

Thx

1reaction
luabudcommented, May 15, 2020

Thanks from bringing it up @WeetA34, I created https://github.com/microsoft/vscode-docs/issues/3674 so we can clarify that in our documentation.

We might need to revisit how we handle this in the extension as well.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Environment variables to configure the AWS CLI
If defined, this environment variable overrides the value for the profile setting region . You can override this environment variable by using the...
Read more >
We need to talk about the .env | Platform.sh
Environment variables are system-global string values that any application can read at any time and use that to make decisions about what code ......
Read more >
Working with Environment Variables in Python - Twilio
In my opinion, a better way to manage your environment variables is to store them in a .env (pronounced dot env) file. A...
Read more >
Environment Variables in Apache
The most basic way to set an environment variable in Apache is using the ... possible to override or change the standard CGI...
Read more >
Use environment variables | Cloud Run Documentation
The environment variables defined in the container runtime contract are reserved and cannot be set. In particular, the PORT environment variable is injected ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found