Config expressions are a powerful feature to load the
devspace.yaml in a more dynamic way. A config expression works by specifying
$( my bash expression ) instead of a field and the stdout of the bash expression is taken as value for the option or complete section. Config expressions are evaluated after variables and profiles are applied to the config and can change parts of the config.
- Load From File
- If Else
- If Dev
- If Variable
- Generate Section
- Return JSON
- Force String
Load a deployment specification from file:
You can use either inline or multi-line if else:
Disable image building during
Add sync path if profile is "debug"
Generate a whole section through a script:
Since json is a subset of yaml, you can also return regular json in a expression:
By default, DevSpace will try to convert the stdout to a number, bool or yaml value, however you can also force the return value to be a string by using
Expressions are evaluated in a golang shell that is syntax compatible to a regular POSIX shell and works on all operating systems.
Variables are resolved before and after applying expressions, which means that you can load a section from file within an expression that contains a variable which will still be resolved afterwards.
devspace print can be used to test your config expressions and shows the config after all profiles, variables and expressions were applied.