Input-based Variables
If source: all (default) | input
, DevSpace may ask the user a question to determine the value of a config variable.
- Question
- Options
- Password
Ignore Env Variables
If you want DevSpace to ignore environment variables, you can explicitly define source: input
to make sure only explict user input will be used to set the value of the variable.
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.
default
The default
option expects a string defining the default value for the variable.
Type Casting
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}
.
question
The question
option expects a string with a question that will be asked when the variable is not defined. DevSpace tries to resolve the variable according to the source
of the variable and if it is not set via any of the accepted sources, DevSpace will prompt the user to define the value by entering a string.
Question
- Defining the
question
is optional but often helpful to provide a better usability for other users. - If valid
options
for the variable value are configured, DevSpace will show a picker/selector instead of a regular input field/prompt. - If a
default
value is configured for the variable, DevSpace will use thisdefault
value as default answer for the question that can be easily selected by pressing enter.
question
Default Value For options
The options
option expects an array of strings with each string stating a allowed value for the variable.
Example: Define Variable Options
Explanation:
If the variable REGISTRY
is used for the first time during devspace deploy
, DevSpace will ask the user to select which value to use by showing this question:
password
The password
option expects a boolean that defines if DevSpace should hide the user input when the user provides the value for this variable by entering a response to the question asked in the command line.
password
Default Value For Example: Hide User Response
Explanation:
If the variable REGISTRY_TOKEN
is used for the first time during devspace deploy
, DevSpace will ask the user to provide a value by showing this question:
The response the user enters will be hidden as *******
to protect others from seeing the input while the user is typing.
validationPattern
The validationPattern
option expects a string stating a regular expression that validates if the value entered by the user is allowed as a value for this variable.
info
If the provided value does not match the regex in validationPattern
, DevSpace will either show a generic error message or the message provided in validationMessage
.
validationMessage
The validationMessage
option expects a string stating an error message that is shown to the user when providing a value for the variable that does not match the regex provided in validationPattern
.