Skip to main content

Set a configuration key/value pair

Usage

$ skpr config set dev site.name Example

You can also tell Skpr to store your key/value pair as a secret, but please note these "secrets" are stored as Kubernetes secrets and can be decoded with relative ease. Anything stored should be appropriate for a developer on your project to see and consume.

$ skpr config set --secret dev google.analytics.api xxxxxxxxxxxxxxxxxxxxx

Handling multiline values with special characters

When dealing with multiline values, you may want to avoid special characters, such as dashes -, being incorrectly interpreted as bash command options. To avoid this, add -- to signify the end of command options.

For example:

$ MY_SECRET_VALUE = `cat /path/to/myfile.txt`
$ skpr config set --secret dev my.secret.key -- "${MY_SECRET_VALUE}"

Usage in CI/CD Pipelines

If you have a configuration item which is already set, you will be prompted to override the setting or not.

Key already exists, are you sure you want to replace it? [yes/no]: 

This can cause some issues in CI. If you do not have access to stdin for the command, you can run the command with the --force flag like this:

$ skpr config set --force --secret dev google.analytics.api xxxxxxxxxxxxxxxxxxxxx

More Information

 skpr config delete --help
usage: skpr config delete [<flags>] <environment> <key>

Deletes a config value for the specified environment.

Flags:
--help Show context-sensitive help (also try --help-long and --help-man).

Args:
<environment> Environment as configured. Usually one of: prod/staging/dev.
<key> Name of key/value pair to delete.

What's next?