Config Profiles
DevSpace allows you to define different profiles for different use cases (e.g. working on different services in the same project, starting certain debugging environments) or for different deployment targets (e.g. dev, staging production).
Profiles allow you to define:
replace
statements to override entire sections of the config.merge
patches (JSON Merge Patch, RFC 7386) to change specific parts of the config.patches
(JSON Patch, RFC 6902) to modify certain paths in the config.
Combine several strategies
It is possible to use several strategies together within one profile. The execution order inside a single profile is:
replace
merge
patches
You can also apply multiple profiles through the --profile
flag
Debug Profiles
The following command is useful to verify that the profile modifies the config as intended:
The above command would print the config after applying all profile patches
and replace
statements from profile-1
first and then profile-2
.
A profile has to be configured in the profiles
section of the devspace.yaml
.
#
Useful Commandsdevspace print -p [profile]
#
The following command is useful to verify that the profile modifies the config as intended:
The above command would print the config after applying all profile patches
and replace
statements from profile-1
first and then profile-2
.
Apply Multiple Profiles with Flags
It is possible to apply multiple profiles in a single command with the --profile
flag. This flag can take one or multiple profiles that will be applied in the order that they are specified.
Example:
devspace list profiles
#
To get a list of available profiles, you can run this command:
devspace use profile [profile]
#
To permanently switch to a different profile, you can run this command:
note
Permanently switching to a profile means that all future commands (e.g. devspace deploy
or devspace dev
) will be executed using this profile until the user resets the profile (see below).
devspace use profile --reset
#
To permanently switch back to the default configuration (no profile replaces and patches active), you can run this command:
devspace [deploy] -p [profile]
#
Most DevSpace commands support the -p / --profile
flag. Using this flag, you can run a single command with a different profile without switching your profile permenantly: