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.

Workspace-level environment variable *definitions*

See original GitHub issue

Often I find myself wanting to associate a workspace with an environment variable (e.g. server domain name, development/production tag) but do not want to create a global system environment variable or pollute ~/.bash_profile with such a variable. I would like such an environment variable to be associated only with the workspace “namespace” and be used for tasks, launch configs and integrated terminals started in that workspace.

I would like to suggest adding an env section to the .code-workspace file format similar to that shown below. It is crucial that a .env file argument be supported to allow environment variables to be excluded from source control (e.g. non-source controlled variables could be placed in .env file which is specified in .gitignore).

Then different “flavours” of the same workspace (each using different clones of the same repos) could be used on the same computer - great for side-by-side comparison debugging or temporarily experimenting with a different setup etc.

{
	"folders": [
		{
			"name": "Api",
			"path": ".."
		},
		{
			"name": "Processing",
			"path": "../../client/Processing"
		}
	],
	"env": {
		"NODE_ENV": "development",
		"DOMAIN": "backend.example.com"
	},
	"launch": {
		"configurations": [],
		"compounds": [
			{
				"name": "Api + Ws",
				"configurations": [
					"Api",
					"Ws",
				]
			}
		]
	}
}

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:49
  • Comments:12

github_iconTop GitHub Comments

10reactions
vscodebot[bot]commented, Jan 15, 2020

This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 20 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

6reactions
vscodebot[bot]commented, Jan 17, 2020

🙂 This feature request received a sufficient number of community upvotes and we moved it to our backlog. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Variables reference - Visual Studio Code
Predefined variables. The following predefined variables are supported: ${userHome} - the path of the user's home folder; ${workspaceFolder} - the path of ...
Read more >
Using Workspace variables in deployment variables
Is there any way of having a deployment variable reference a workspace variable? ... Is there just a way to define environments at...
Read more >
Set Environment Variable At Eclipse workspace level for all ...
Only option which I can think of is similar to yours where you can create multiple shell scripts(linux) or batch files(windows) and set...
Read more >
Environment variables | Docs - Buddy.Works
For example, if you have two the same variables, but one is defined on the workspace level and another on the pipeline level,...
Read more >
Path variables
Path variables can be either defined at the project level or at the workspace level. Creating path variables at the project level ensures...
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