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.

Support envfile for tasks.json

See original GitHub issue

The node and Go debuggers both support specifying an env file for environment variables instead of the env hash. It would be great if we could use the same file in tasks.json to have a single source of truth that can also be used by non-vscode scripts

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:75
  • Comments:32 (8 by maintainers)

github_iconTop GitHub Comments

22reactions
ayoubserticommented, Feb 5, 2020

Hi is there any progress on this request? I need also to define some .env variables locally to be used by tasks.json

19reactions
adriantorriecommented, May 24, 2019

Need .env file support in tasks.

  1. Keeps secrets out of git
  2. Define my env vars in one place
  3. It is a standard workflow for multiple languages to use .env file

Here is another use case:

  • I was hoping to recreate this Makefile (link) in tasks.json to prevent having to install make on Windows
  • However I need to pass build args from my .env file (The docker extension for VSCode isn’t flexible enough for this approach)
  • Because I cant do the above: I now have to write separate docker-compose.<make step>.yml files in the meantime
  • But: docker-compose doesn’t support BuildKit yet, which means I can’t bind mount local volumes into the build scope, which would allow me to export unit test results from the images at build time (also don’t get the parallel stage builds either)
  • Some of the runtime arguments are secrets (i.e. docker run -e password=$PASSWORD), so there is no way they are being hard-coded into tasks.json
  • So I don’t have any means to a fully-functional multi-stage build with build-time bind mounts

The above workflow example in the Makefile will be reused in our CI pipeline.

  • Essentially allows our developers to run locally what will be run in the CI pipeline
  • This gives us a CI pipeline agnostic approach that prevents vendor lock-in

So the only thing we’re missing at the moment is being able to give devs a clean workflow on their local computers.

** /s ** Or we tell them them to maintain both .env and tasks.json themselves and keep them out of git, and that we expect them to do this for the 50+ microservices we have built in the past 8 months, and to keep doing it for the additional ones in the future.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I access .env variables in tasks.json within vscode?
json file of a C# project in vscode . In my launch.json file I have this code to parse a .env file: "configurations":...
Read more >
Variables reference - Visual Studio Code
json and tasks.json files using ${variableName} syntax. Predefined variables. The following predefined variables are supported: ${userHome} - the path of ...
Read more >
Visual Studio Code: Setting Environment Variable for Tasks
Click Debug icon > Configure gear icon on the Debug view top bar > Select debug environment: Node. It will generate a launch.json...
Read more >
Passing environment variables to a container
env file extension and there is a limit of ten files to a task definition. We don't enforce a size limit on the...
Read more >
How to use a .env file to load environment variables in a dev ...
Loading environment variables using a . env file when working with Remote - Containers or GitHub Codespaces. Check out the docs for more...
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