Environment Variables
If the source
is env
, DevSpace will not ask the user a question and instead use environment variables to determine the value of the variable.
images:
database:
image: "mysql:${MYSQL_VERSION}"
vars:
- name: MYSQL_VERSION
source: env
default: "5.5"
If source
is env
and the environment variable is not defined, DevSpace will use the default
value or terminate with a fatal error, if there is no default
value configured.
By default, the type (string, int, bool) of variable will be determined by the type of its default
value (if defined) or automatically detected if no default value is defined. To explicitly use the value of a variable as a string, use $!{VAR_NAME}
instead of ${VAR_NAME}
.
Configuration
name
The name
option expects a string stating the name of the config variable that will be used to reference it within the remainder of the configuration.
The name
of a config variable must be unique and is mandatory when defining a config variable.
default
The default
option expects a string defining the default value for the variable.
If a default value is specified, DevSpace will assume the type of the default value as the type for the variable, i.e. when default: "123"
is defined and a value of 123
(int) is provided it would be casted to "123"
(string). To explicitly use the value of a variable as a string within devspace.yaml
, use $!{VAR_NAME}
instead of ${VAR_NAME}
.