How and Where to Create Environment Variable? #6321
-
I usually run my code-server in the background via this command:
Now, how and where do I add environment variables for it? I am also confused as to the configuration file and environment variable mentioned in the docs are the same or different. The environment variable is mentioned multiple times in the docs:
But there is no actual example of how and where to create it. Can we have an example |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Now, how and where do I add environment variables for it?
You can add environment variables to a systemd service by editing
the service file. It supports both directly setting environment
variables or setting a file that contains environment variables.
For example:
```
[Service]
Environment=Name=value
EnvironmentFile=/foo/env
```
I am also confused as to the configuration file and environment
variable mentioned in the docs are the same or different.
Which environment variable are you referring to? Some of them
have equivalents in the config file (like `PASSWORD`) but most do
not. The environment variable takes precedence over the config
file in cases where both are set.
|
Beta Was this translation helpful? Give feedback.
-
I'm grasping some new knowledge on your comment @code-asher, I had no idea the docs were mentioning I am trying to configure my code-server in many ways, such as changing the name to I am also trying to configure code-server to use my own proxy, to use something like As of now, the configurations I mentioned are |
Beta Was this translation helpful? Give feedback.
Ah yeah the way you set environment variables or add flags will depend on the way you run code-server, and it can also change depending on the operating system. In your case that happens to be systemd and presumably GNU/Linux but there are other paths.
So with that in mind, maybe every time we talk about environment variables in the docs we should link to a section about environment variables and how to set them based on how you run code-server, although admittedly part of me thinks that how to set environment variables is a little too far out of scope for code-server's docs.
Alternatively, maybe instead of recommending environment variables we should recommend editing the config file and…