Command 'config'

See also: deploy, status, model-config, controller-config

Summary

Gets, sets, or resets configuration for a deployed application.

Usage

juju config [options] <application name> [--branch <branch-name>] [--reset <key[,key]>] [<attribute-key>][=<value>] ...]

Options

Flag Default Usage
--B, --no-browser-login false Do not use web browser for authentication
--color false Use ANSI color codes in output
--file path to yaml-formatted configuration file
--format yaml Specify output format (json|yaml)
--m, --model Model to operate in. Accepts [<controller name>:]<model name>|<model UUID>
--no-color false Disable ANSI color codes in tabular output
--o, --output Specify an output file
--reset Reset the provided comma delimited keys

Details

To view all configuration values for an application, run juju config By default, the config will be printed in yaml format. You can instead print it in json format using the --format flag: juju config --format json

To view the value of a single config key, run juju config key To set config values, run juju config key1=val1 key2=val2 … This sets “key1” to “val1”, etc. Using the @ directive, you can set a config key’s value to the contents of a file: juju config key=@/tmp/configvalue You can also reset config keys to their default values: juju config --reset key1 juju config --reset key1,key2,key3 You may simultaneously set some keys and reset others: juju config key1=val1 key2=val2 --reset key3,key4

Config values can be imported from a yaml file using the --file flag: juju config --file=path/to/cfg.yaml The yaml file should be in the following format: apache2: # application name servername: “example.com” # key1: val1 lb_balancer_timeout: 60 # key2: val2 … This allows you to e.g. save an app’s config to a file: juju config app1 > cfg.yaml and then import the config later. You can also read from stdin using “-”, which allows you to pipe config values from one app to another: juju config app1 | juju config app2 --file - You can simultaneously read config from a yaml file and set/reset config keys as above. The command-line args will override any values specified in the file.

By default, any configuration changes will be applied to the currently active branch. A specific branch can be targeted using the --branch option. Changes can be immediately be applied to the model by specifying --branch=master. For example:

juju config apache2 --branch=master servername=example.com juju config apache2 --branch test-branch servername=staging.example.com

Rather than specifying each setting name/value inline, the --file flag option may be used to provide a list of settings to be updated as a yaml file. The yaml file contents must include a single top-level key with the application’s name followed by a dictionary of key/value pairs that correspond to the names and values of the settings to be set. For instance, to configure apache2, the following yaml file can be used:

apache2: servername: “example.com” lb_balancer_timeout: 60

If the above yaml document is stored in a file called config.yaml, the following command can be used to apply the config changes:

juju config apache2 --file config.yaml

Finally, the --reset flag can be used to revert one or more configuration settings back to their default value as defined in the charm metadata:

juju config apache2 --reset servername juju config apache2 --reset servername,lb_balancer_timeout


Last updated 1 year, 1 day ago. Help improve this document in the forum.