unifi config
About 1116 words
View and edit the configuration of unifi-cli.
Aliases: configuration
View and edit the configuration of unifi-cli.
The configuration file holds your accounts, controllers and contexts (managed with unifi login and unifi ctx) and your preferences: theme, output format, dashboard layout, logging and the prompt segment. API keys are never stored in it; they live in the OS keychain or, on machines without one or with UNIFI_CREDENTIAL_STORE=file, in the credentials file next to it, which only you can read.
Commands
unifi config edit: Open the configuration file in your editorunifi config get: List the preferences, or print the value of oneunifi config init: Write a commented starter configurationunifi config path: Show where unifi-cli keeps its filesunifi config schema: Print the JSON schema of the configuration or of a theme fileunifi config set: Set a preferenceunifi config view: Print the effective configuration
unifi config edit
Open the configuration file in your editor.
Usage
unifi config edit [flags]Open the configuration file in your editor and validate it when the editor exits.
The editor is taken from $VISUAL, then $EDITOR, and falls back to vi. You edit a copy: the configuration file is replaced, in one step, only when the copy validates. Otherwise the file stays as it was, the error is shown, and the rejected text is saved next to the file with the suffix .rejected so nothing you typed is lost. When no configuration file exists yet, the commented starter configuration of unifi config init is opened.
Examples
unifi config edit
EDITOR='code --wait' unifi config editFlags
| Flag | Description |
|---|---|
-y, --yes | do not ask for confirmation; accepted by every command that changes something |
unifi config get
List the preferences, or print the value of one.
Usage
unifi config get [key] [flags]Aliases: list, ls
List the preferences with their values, or print the value of one.
With a key the bare value is printed, ready for use in a script. Keys are dotted paths below preferences in the configuration file:
theme
Theme to render with
colorScheme
Theme variant: auto detects the terminal background
output
Default output format
glyphs
Glyph set overriding the theme's; empty lets the theme decide
log.level
Minimum level written to the log file
telemetry.otlpEndpoint
OTLP/HTTP endpoint for traces; empty turns tracing off
prompt.format
Prompt segment template: {context}, {site}, {controller}, {account}
dashboard.refresh
Interval between dashboard refreshes, such as 5sExamples
unifi config get
unifi config get theme
unifi config get log.level --output jsonunifi config init
Write a commented starter configuration.
Usage
unifi config init [flags]Write a starter configuration in which every preference is present and explained by a comment, including the default dashboard layout, as a base for editing by hand.
An existing configuration file is left alone unless --force is given. With --force the file is rewritten in the commented form; your accounts, controllers, contexts and preference values are carried over, comments you added yourself are not.
Examples
unifi config init
unifi config init --force
unifi config init && unifi config editFlags
| Flag | Description |
|---|---|
--force | rewrite an existing configuration file |
-y, --yes | do not ask for confirmation; accepted by every command that changes something |
unifi config path
Show where unifi-cli keeps its files.
Usage
unifi config path [flags]Aliases: paths
Show where unifi-cli keeps its files: the configuration file, the themes directory, the log file, the credentials file that is used when the machine has no OS keychain, and the cache.
Relocate the configuration with the UNIFI_CONFIG or XDG_CONFIG_HOME environment variables, and the log and the cache with XDG_STATE_HOME.
The cache holds answers that are slow to fetch and rarely change, such as a controller's sites and the candidates of shell completions, for minutes at most; it never holds an API key or another secret. Nothing in it is needed: delete the directory to clear it. --no-cache on any command, or UNIFI_NO_CACHE=1 in the environment, bypasses it.
Examples
unifi config path
tail -f "$(unifi config path --output json | jq -r .logFile)"unifi config schema
Print the JSON schema of the configuration or of a theme file.
Usage
unifi config schema <config|theme> [flags]Print the JSON schema of the configuration file or of a theme file.
The schema goes to standard output unchanged, so it can be saved for an editor or a validator. Files written by unifi-cli already reference the published schemas:
https://unifi-cli.specht-labs.de/schema/config.schema.json
https://unifi-cli.specht-labs.de/schema/theme.schema.jsonExamples
unifi config schema config > config.schema.json
unifi config schema theme | jq '.properties | keys'unifi config set
Set a preference.
Usage
unifi config set <key> <value> [flags]Set a preference and save the configuration.
The value is validated before anything is written: a theme must exist, an enumerated preference must use one of its values, the dashboard refresh must be a duration. Preferences that can be switched off take an empty value. Keys:
theme
Theme to render with
colorScheme
Theme variant: auto detects the terminal background
output
Default output format
glyphs
Glyph set overriding the theme's; empty lets the theme decide
log.level
Minimum level written to the log file
telemetry.otlpEndpoint
OTLP/HTTP endpoint for traces; empty turns tracing off
prompt.format
Prompt segment template: {context}, {site}, {controller}, {account}
dashboard.refresh
Interval between dashboard refreshes, such as 5sExamples
unifi config set theme nord
unifi config set colorScheme dark
unifi config set output json
unifi config set prompt.format '{context} ยท {site}'
unifi config set telemetry.otlpEndpoint http://localhost:4318
unifi config set telemetry.otlpEndpoint ""Flags
| Flag | Description |
|---|---|
-y, --yes | do not ask for confirmation; accepted by every command that changes something |
unifi config view
Print the effective configuration.
Usage
unifi config view [flags]Aliases: show
Print the effective configuration: the file's content with every preference it leaves out filled with its default. The output is YAML unless --output json is given. It never contains API keys.
Examples
unifi config view
unifi config view --output json | jq .preferences.themeGlobal flags
These flags are accepted by every command.
| Flag | Description |
|---|---|
--color-scheme <string> | color scheme: auto, dark or light |
--context <string> | context to use instead of the current one |
--no-cache | ask the controller for everything instead of using cached answers |
-o, --output <string> | output format: text, wide, json, yaml (table is another name for text) |
-s, --site <string> | site to act on instead of the context's default site |
--theme <string> | theme to render with instead of the configured one |
