<a id="command-juju-config"></a>

# `juju config`

> See also: [deploy](https://documentation.ubuntu.com/juju/4.0/reference/juju-cli/list-of-juju-cli-commands/deploy.md#command-juju-deploy), [status](https://documentation.ubuntu.com/juju/4.0/reference/juju-cli/list-of-juju-cli-commands/status.md#command-juju-status), [model-config](https://documentation.ubuntu.com/juju/4.0/reference/juju-cli/list-of-juju-cli-commands/model-config.md#command-juju-model-config), [controller-config](https://documentation.ubuntu.com/juju/4.0/reference/juju-cli/list-of-juju-cli-commands/controller-config.md#command-juju-controller-config)

## Summary

Get, set, or reset configuration for a deployed application.

## Usage

```text
juju config [options] <application 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                                    |

## Examples

To view all configuration values for an application, run

```none
juju config mysql --format json
```

To set a configuration value for an application, run

```none
juju config mysql foo=bar
```

To set some keys and reset others:

```none
juju config mysql key1=val1 key2=val2 --reset key3,key4
```

To set a configuration value for an application from a file:

```none
juju config mysql --file=path/to/cfg.yaml
```

## Details

To view all configuration values for an application:

```none
juju config <app>
```

By default, the config will be printed in a `yaml` format. You can instead print it
in a `json` format using the `--format` flag:

```none
juju config <app> --format json
```

To view the value of a single config key, run

```none
juju config <app> key
```

To set config values, run

```none
juju config <app> 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:

```none
juju config <app> key=@/tmp/configvalue
```

The maximum size of a config value read from a file this way is 5 MiB.

You can also reset config keys to their default values:

```none
juju config <app> --reset key1
juju config <app> --reset key1,key2,key3
```

You may simultaneously set some keys and reset others:

```none
juju config <app> key1=val1 key2=val2 --reset key3,key4
```

Config values can be imported from a yaml file using the –file flag:

```none
juju config <app> --file=path/to/cfg.yaml
```

The `yaml` file should be in the following format:

```none
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:

```none
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:

```none
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.

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:

```none
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:

```none
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:

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