Not sure about YAML, but in bash
, the expression ${VARNAME-DEFAULT}
means: Replace by the contents of the variable VARNAME
if it exists, otherwise use DEFAULT
Here's an example:
$ echo "Hello ${PL-Earth}"
Hello Earth
$ PL=Neptune
$ echo "Hello ${PL-Earth}"
Hello Neptune
$ unset PL
$ echo "Hello ${PL-Earth}"
Hello Earth
When I look at your yaml file, it looks very similar: If DEBUG is set, use whatever is set, otherwise use a single space, etc. This is actually a common usage, adding the line
DEBUG=${DEBUG- }
ensures that a variable with the name DEBUG
exists, even if it contains only a space.
Well, as for how to use it, set the corresponding environment variables before you execute whichever program uses this yaml file.
$ export DEBUG='-g -O0 -fbacktrace -Wall'
$ <Call to program>
I don't know much about docker, but there is almost certainly a way to set environment variables in a docker configuration.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…