Version: 5.7

Environment Variables

If the source is command, DevSpace will not ask the user a question and instead execute a command to determine the value of the variable.

images:
database:
image: "mysql:${MYSQL_VERSION}"
vars:
- name: MYSQL_VERSION
source: command
command: echo
args: ["5.5"]

If you need different commands depending on the operating system you can use commands:

images:
database:
image: "mysql:${MYSQL_VERSION}"
vars:
- name: MYSQL_VERSION
source: command
commands:
- command: bash
args: ["-c", "echo '5.5'"]
os: linux,darwin
command: echo
args: ["5.5"]
info

If not command for the current operating system can be found under commands, the command and args will be used as fallback.

Variable Type

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.

Must be unique

The name of a config variable must be unique and is mandatory when defining a config variable.

command & args

The command and arguments to execute to retrieve the value of the variable. The captured stdout of the command will be used as variable value. Whitespaces and newlines will be trimmed from the command output.

commands

Commands expects an array of objects that define commands for specific operating systems. If no command can be found for the current operating system in commands, then command will be used as fallback.

vars:
- name: MYSQL_VERSION
source: command
commands:
# Use command on linux
- command: bash
args: ["-c", "echo '5.5'"]
os: linux
# Use command on mac
- command: bash
args: ["-c", "echo '5.6'"]
os: darwin
# Use on all other operating systems
command: echo
args: ["5.5"]

default

If the command returns nothing, this is the value that will be used for this variable.