Configuration file
About 941 words
This page lists every field of the configuration file, ~/.config/unifi-cli/config.yaml. For a walkthrough, see the configuration guide.
The file's JSON schema is published at https://unifi-cli.specht-labs.de/schema/config.schema.json and printed by unifi config schema config. Unknown fields are rejected at every level.
Top level
| Field | Type | Required | Description |
|---|---|---|---|
apiVersion | string | yes | File format version. Always unifi.specht-labs.de/v1alpha1. |
kind | string | yes | Always Config. |
currentContext | string | no | Name of the context commands use when --context isn't given. |
accounts | list of Account | no | Identities unifi-cli can authenticate as. |
controllers | list of Controller | no | UniFi consoles and self-hosted controllers. |
contexts | list of Context | no | Named combinations of an account, a controller and a default site. |
preferences | Preferences | no | Presentation and behavior preferences. |
Account
| Field | Type | Required | Description |
|---|---|---|---|
name | string | yes | Name of the account in this file. The stored API key is filed under this name. |
type | cloud or local | yes | cloud: a UI account with a Site Manager API key. local: an API key created on one controller. |
email | string | no | E-mail address of the UI account. Informational. |
An account has no secret field. Its API key lives in the OS keychain, or in the credentials file on machines without one or with UNIFI_CREDENTIAL_STORE=file.
Controller
| Field | Type | Required | Description |
|---|---|---|---|
name | string | yes | Name of the controller in this file. |
address | string | for local accounts | URL of the controller on the local network, such as https://unifi.local. Without a path, the UniFi OS prefix /proxy/network is added; an address with a path is used as it is. |
consoleId | string | for cloud accounts | Console identifier at unifi.ui.com. unifi consoles get --output wide shows it. |
cloudAddress | string | no | Overrides the Site Manager API URL, https://api.ui.com. Only needed for testing against the demo controller. |
insecureSkipTlsVerify | boolean | no | Skip TLS certificate verification. Default false. Prefer caFile. |
caFile | string | no | PEM file with the certificate authority or the self-signed certificate of the controller. unifi login --pin-certificate saves the console's certificate under certs/ in the configuration directory and sets this field. |
Context
| Field | Type | Required | Description |
|---|---|---|---|
name | string | yes | Name of the context. |
account | string | yes | Name of an entry in accounts. |
controller | string | yes | Name of an entry in controllers. |
site | string | no | Default site, by name. Empty selects the controller's only site, or the one named Default. |
Preferences
| Field | Type | Default | Description |
|---|---|---|---|
theme | string | unifi | Theme name: a built-in theme or <name>.yaml in the themes directory. |
colorScheme | auto, dark, light | auto | Theme variant. auto detects the terminal background. |
glyphs | unicode, ascii | unset | Overrides the theme's glyph set. |
output | text, wide, json, yaml | text | Default output format. |
dashboard | Dashboard | see below | Layout of the dashboard. |
log.level | debug, info, warn, error | info | Minimum level written to the log file. UNIFI_LOG_LEVEL overrides it for one run. |
telemetry.otlpEndpoint | string | unset | OTLP/HTTP endpoint for traces, such as http://localhost:4318. Tracing is off while empty. |
prompt.format | string | {context} | Template of the prompt segment with the placeholders {context}, {site}, {controller} and {account}. |
The scalar preferences can be read and written with unifi config get <key> and unifi config set <key> <value>, using these keys: theme, colorScheme, output, glyphs, log.level, telemetry.otlpEndpoint, prompt.format and dashboard.refresh.
Dashboard
| Field | Type | Default | Description |
|---|---|---|---|
refresh | duration | 5s | Interval between refreshes, as a Go duration such as 5s or 1m. |
rows | list of DashboardRow | the default layout | Rows of widgets from top to bottom. |
DashboardRow
| Field | Type | Required | Description |
|---|---|---|---|
height | integer | no | Row height in terminal lines. 0 or unset lets the widgets choose. |
widgets | list of Widget | yes | Widgets from left to right. |
Widget
| Field | Type | Required | Description |
|---|---|---|---|
type | string | yes | Widget type. See the widget reference. |
title | string | no | Overrides the widget's title. |
span | integer | no | Share of the row width relative to the other widgets in the row. Default 1. |
options | map | no | Widget-specific settings, such as limit. |
Default layout
When rows is empty, this layout applies:
dashboard:
refresh: 5s
rows:
- widgets:
- type: health
span: 1
- type: internet
span: 1
- type: isp
span: 1
- height: 12
widgets:
- type: traffic
span: 3
- type: clients
span: 2
- widgets:
- type: top-clients
span: 1
options:
limit: 6
- type: top-aps
span: 1
options:
limit: 6
- type: air-view
span: 1
- widgets:
- type: devices
span: 3
- type: events
span: 2Complete example
# yaml-language-server: $schema=https://unifi-cli.specht-labs.de/schema/config.schema.json
apiVersion: unifi.specht-labs.de/v1alpha1
kind: Config
currentContext: home
accounts:
- name: me
type: cloud
email: [email protected]
- name: udm-local
type: local
controllers:
- name: udm
consoleId: 0123456789ABCDEF
- name: udm-lan
address: https://192.168.1.1
caFile: ~/.config/unifi-cli/udm.pem
contexts:
- name: home
account: me
controller: udm
site: Default
- name: home-lan
account: udm-local
controller: udm-lan
preferences:
theme: nord
colorScheme: auto
output: text
log:
level: info
prompt:
format: "{context} ยท {site}"
dashboard:
refresh: 10sexamples/config.yaml in the repository adds a customized dashboard.
Related files
| File | Default path | Purpose |
|---|---|---|
| Themes | ~/.config/unifi-cli/themes/<name>.yaml | Your own themes; see the theme reference |
| Credentials | ~/.config/unifi-cli/credentials.yaml | API keys on machines without an OS keychain, or with UNIFI_CREDENTIAL_STORE=file; mode 0600 |
| Log | ~/.local/state/unifi-cli/unifi.log | JSON lines; rotated at 5 MB, three files kept |
| Shell history | ~/.local/state/unifi-cli/history | History of unifi shell; secrets are redacted |
| Pinned certificates | ~/.config/unifi-cli/certs/<controller>.pem | Certificates pinned by unifi login |
| Cache | ~/.local/state/unifi-cli/cache/ | Site lists, completion candidates, the last dashboard snapshot; safe to delete |
The environment reference lists the variables that relocate them.
