CLI configuration
When you run a server command (status, authorize, query, policy, or
fact), the Verdict CLI resolves the target instance URL and API key from
command-line flags, environment variables, saved connection profiles, and
per-project configuration.
To save a reusable connection profile and bind it to your current project
directory, run verdict profile add followed by verdict profile use:
verdict profile add development --endpoint http://localhost:4891 --no-authverdict profile use development --projectverdict config show --jsonSaving a profile with profile add records its endpoint and credentials on
disk, while profile use activates it (either for the current project with
--project, or as your global default).
- Supplying an API key: For an authenticated server, omit
--no-authto enter the key at the interactive prompt, or pass--api-key-stdinto read the key from standard input. When runningprofile add --json, you must pass either--api-key-stdinor--no-auth. - Inspecting the active connection: Run
verdict config showat any time to see the resolved profile, instance URL, and the source of each setting. It reports whether an API key is present without printing the secret value.
Precedence
Section titled “Precedence”When multiple configuration sources are present, the CLI resolves each setting independently from highest to lowest priority:
| Setting | Resolution order, highest priority first |
|---|---|
| Profile | --profile, VERDICT_PROFILE, project selection (.verdict/profile.json), global default profile |
| Instance URL | --endpoint (or --host), VERDICT_HOST, selected profile URL, http://localhost:4891 |
| API key | VERDICT_API_KEY, --api-key, selected profile credential when its normalized URL matches the effective instance URL |
Keep these resolution rules in mind when combining flags, environment variables, and profiles:
- Endpoint flags: If both
--endpointand--hostare passed,--endpointwins. - Explicit profile selection: Passing
--profileor settingVERDICT_PROFILEbypasses.verdict/profile.jsondiscovery. Selecting a profile name that does not exist fails immediately rather than falling back to another profile. - URL-scoped credentials: A profile’s stored API key is bound to its full
normalized instance URL (including any path prefix). If you override the URL
with
--endpointorVERDICT_HOSTto point to a different origin or path, the CLI will not forward the profile’s stored API key to that new URL. - Policy publication config:
verdict policy publishcan also use theserver.profilefield from its project configuration file when--profile,VERDICT_PROFILE, and--localare omitted. Becauseverdict config showevaluates only its own command invocation and does not load the policy publication file, pass explicit connection flags when you need both commands to target the same profile.
Local connections
Section titled “Local connections”Passing --local targets http://localhost:4891 directly without reading saved
profiles or environment credentials (VERDICT_PROFILE, VERDICT_HOST,
VERDICT_API_KEY).
--local cannot be combined with --endpoint, --host, or --profile. You
can still pass an explicit --api-key flag alongside --local when testing a
local server started with API key authentication.
Stored configuration
Section titled “Stored configuration”Global configuration directory
Section titled “Global configuration directory”The CLI stores saved profiles and credentials in VERDICT_CONFIG_DIR when set.
Otherwise, it uses the platform default:
- macOS and Linux:
$XDG_CONFIG_HOME/verdict, or~/.config/verdictwhenXDG_CONFIG_HOMEis unset. - Windows:
%APPDATA%/verdict, or~/AppData/Roaming/verdictas a fallback.
Inside that directory, the CLI maintains two files:
config.jsonstores profile names, endpoint URLs, credential references, and the global default profile name.credentials.jsonstores the referenced API keys on disk (not in an operating-system keychain). Profile updates create the configuration directory with mode0700and both JSON files with mode0600.
Project profile selection
Section titled “Project profile selection”Per-project profile selection is stored in .verdict/profile.json. When looking
for a project profile, the CLI walks upward from the current working directory
and stops after checking a Git repository root, your home directory, or the
filesystem root.
verdict profile use <name> --projectupdates the nearest.verdict/profile.json(or creates one at the project root) and adds/profile.jsonto.verdict/.gitignoreso local profile choices are not committed by default.verdict profile unset --projectremoves the project selection.- Omitting
--projectwithprofile useorprofile unsetupdates the global default profile inconfig.json. verdict profile delete <name>deletes the profile, removes its stored credential, and clears the global default if it matched that profile. Any.verdict/profile.jsonfile that still references a deleted profile must be updated withprofile use --projector cleared withprofile unset --project.
See the profile commands reference for command
flags and JSON output schemas, and the
configuration source
for the implementation of these resolution rules.