Besides reading environment variables available in your terminal session, DevSpace also reads environment variables from the
.env file inside your project. The syntax of the
.env file is the same as for docker-compose:
- Each line should have the format
- There is no special handling of quotation marks. This means that they are part of the
- Lines beginning with # are processed as comments and ignored.
- Environment variables defined in your terminal session (including system variables) always take precendence over the variables in your
- Variables defined in your
.envfile take precende over the default values defined for config variables (configured in the
Define Default Flags
A common use case for the
.env file is to set default flags for the
devspace commands such as
devspace dev or
devspace deploy. You can define the following environment variables to set default flags:
DEVSPACE_FLAGSfor global flags that should be added to each commands (e.g.
DEVSPACE_FLAGS=-s -p dev)
DEVSPACE_[COMMAND]_FLAGSto add default flags for single commands (e.g.
Overriding Default Flags
Specifying flags for a command will override the default flags, e.g. if
DEVSPACE_FLAGS=-s -p dev is configured and you run
devspace dev -p production, the following command would be executed:
devspace dev -s -p production