-
Hello, I'm new to vaultwarden and attempting my first vault with docker. I read a lot about configuration. Most articles about setting up use very few configuration options. There is always a reference between the docker compose an the env-file like that: `environment:
There a lot of configuration values in the env.template. Is it necessary to put in a "reference" like mentioned above in the docker compose or is it possible/recommended to "generally" reference the env-file? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
yes, you can put a reference in yaml to .env, or just write key="value" in yaml |
Beta Was this translation helpful? Give feedback.
-
In Docker Compose, there are two ways to define environment variables:
An example for approach 1: services:
vaultwarden:
env:
- ADMIN_TOKEN="yourtokenhere" And an example for approach 2: services:
vaultwarden:
env_file: .env with the .env file being a plain text file like this:
The .env file, in this case, would have to be saved in the same place as the compose.yml file. As you can see, the syntax between defining in the compose file and in a separate file is the same. You can also use both properties for the same service, in which case keys defined in the compose file will override ones set in the .env file. You can read more about the two properties in the compose specification: https://docs.docker.com/reference/compose-file/services/#env_file This is also where the .env.template file provided in the Vaultwarden code comes into play. Everything you see here is commented out and pre-written with the default value: Lines 2 to 3 in 2903a3a You're free to copy&paste the entire file into your project folder and then uncomment anything you want to adjust with your own settings. If you're fine with the default values, you can simply ignore them in the .env file. In this specific case, I would recommend to change as little as possible via environment variables unless specifically instructed by the installation guide. Nearly all values can be adjusted via the admin panel, which is easier to do down the road than changing the env variables. |
Beta Was this translation helpful? Give feedback.
In Docker Compose, there are two ways to define environment variables:
env
property.env
but you can do whatever you like) where you store all the data you want.An example for approach 1:
And an example for approach 2:
with the .env file being a plain text file like this:
The .env file, in this case, would have to be saved in the same place as the compose.yml file. As you can see, the syntax between defining in the compose file and in…