Skip to content

Environment variables

Muhammet Şafak edited this page Jun 13, 2026 · 3 revisions

Home / Configuration / Environment variables

Environment variables

CommitBrief reads the following environment variables. They override the matching keys in the merged YAML config, and are themselves overridden by explicit CLI flags.

Provider credentials

Variable Effect
ANTHROPIC_API_KEY Sets providers.anthropic.api_key.
OPENAI_API_KEY Sets providers.openai.api_key.
GEMINI_API_KEY Sets providers.gemini.api_key.
OLLAMA_HOST Sets providers.ollama.base_url. Useful when Ollama runs on a non-default host or port.

These are read once at startup via config.ApplyEnv. Empty values are ignored (a present-but-empty env var does not clear a config value).

Active provider / model

Variable Effect
COMMITBRIEF_PROVIDER Sets config.provider. Equivalent to --provider.
COMMITBRIEF_MODEL Sets providers.<active-provider>.model. Equivalent to --model. Requires COMMITBRIEF_PROVIDER or a config.provider already set; applies to whichever provider is active.

Config file location

Variable Effect
COMMITBRIEF_CONFIG Absolute path to the user-level config file; replaces the default ~/.commitbrief/config.yml lookup. Useful for ephemeral CI environments, reproducible tests, and per-shell config overrides.

Locale

Variable Effect
LANG No longer drives language (changed in v1.6.0, ADR-0021). Language is config-driven: --lang → repo output.lang → user output.lang → English. LANG may still affect non-language locale behavior in other libraries.

Color output

Variable Effect
NO_COLOR When set (to anything non-empty), disables ANSI color output everywhere — overrides --color=always and the output.color config field. Standard convention from https://no-color.org.
COMMITBRIEF_NO_COLOR Same effect as NO_COLOR but scoped to CommitBrief specifically. Useful when you want global NO_COLOR=1 off but CommitBrief's output without colors.

Resolution order

Each value is determined by the first non-empty source in this order (lowest precedence first; later sources override earlier ones):

  1. config.Default() skeleton (built into the binary).
  2. User-level YAML (~/.commitbrief/config.yml or $COMMITBRIEF_CONFIG).
  3. Repo-local YAML (<repo>/.commitbrief/config.yml).
  4. Environment variables (this page).
  5. CLI flags (--provider, --model, --lang, --color).

So commitbrief --provider=openai --staged overrides COMMITBRIEF_PROVIDER=anthropic for that one invocation; both override anything in config.yml.

Variables CommitBrief does NOT read

For clarity — these are NOT environment-variable-driven:

  • API key for claude-cli / gemini-cli: the host CLI manages its own credentials; CommitBrief just shells out to it.
  • Custom cache directory: hardcoded to <repo>/.commitbrief/cache/.
  • Custom config directory: only the file location is overridable via COMMITBRIEF_CONFIG; the parent of the file is computed.

See also

Clone this wiki locally