Advanced Configuration and Logging
The default CLI configuration can be overridden by creating a YAML file called config.yaml
in the
following location:
$HOME/.config/@smartthings/cli
on MacOS or Linux%LOCALAPPDATA%\@smartthings\cli
on Windows
Profiles
You can define multiple profiles with different configurations. Top-level keys other than the special logging
key define these profiles.
The default profile is named "default" and will be used unless otherwise specified. Most users can put their configuration options here.
To choose a different profile, you can either set the SMARTTHINGS_PROFILE
environment variable, or use the --profile
(-p
) command line
argument (when both are used, the command line argument overrides the
environment variable.)
Configuration Options
The following per-profile config options are supported:
Option | Default Value | Description |
---|---|---|
indent | 2 | Indent level for JSON or YAML output. |
groupTableOutputRows | true | Separate groups of four rows by a line to make long rows easier to follow across the screen. |
organization | none | UUID of the organization to use in applicable CLI commands. |
token | none | Use a bearer token (such as a PAT) for authentication instead of the default login flow. |
Example
default:
indent: 4
groupTableOutputRows: true
tight:
indent: 1
groupTableOutputRows: false
Logging
Logging is useful when you are developing the CLI itself (rather than using it).
The CLI uses log4js for logging.
Logging is configured using a YAML file called logging.yaml
in the same
location as the config file mentioned above. The contents of this file are
passed directly to log4js, so any valid log4js configuration can be included
here. The following categories are used in the CLI:
- cli - Generic logger used by the CLI. Log entries will have the command name appended. (ex. cli.DriversCommand)
- rest-client - Used for the SDK that interfaces with the SmartThings API.
- login-authenticator - Used in the default OAuth login flow.