Skip to content

Configuration ​

Harbor Pilot reads a small bootstrap file: only what the process needs before it can open its database (where to listen, its public address, the data directory, the master key, TLS, logging and the CLI bridges). Everything else (providers, accounts, routing plans, clients, policies, alert channels) lives in the database and is changed through the UI, the API, the CLI or Terraform. There is no second file-based source of truth.

Where settings come from ​

From lowest to highest precedence:

  1. built-in defaults;
  2. the configuration file, given with --config FILE or HP_CONFIG;
  3. HP_* environment variables;
  4. command-line flags.

The file is optional: with none, defaults, environment variables and flags are used. Unknown keys in the file are an error, so a typo cannot be silently ignored. Check a file before you deploy it:

sh
harbor-pilot config validate --config /etc/harbor-pilot/harbor-pilot.yaml

Example ​

yaml
server:
  listen: 127.0.0.1:8080
  public_url: https://harbor-pilot.example.com   # https outside local development
  data_dir: /var/lib/harbor-pilot
  trusted_proxies: []                           # e.g. ["10.0.0.0/8"] behind a reverse proxy
  shutdown_timeout: 30s
  # metrics_token_file: /etc/harbor-pilot/metrics.token
  # tls:
  #   cert_file: /etc/harbor-pilot/tls.crt
  #   key_file: /etc/harbor-pilot/tls.key
security:
  master_key_file: /etc/harbor-pilot/master.key   # harbor-pilot keys generate
  previous_master_key_files: []
  secret_roots: [/etc/harbor-pilot/secrets]
  # secret_env_prefixes: [HP_SECRET_]
log:
  level: info
# bridges:
#   claude_code:
#     binary: /usr/local/bin/claude
#   codex:
#     disabled: true
# gateway:
#   usage_headers: auto

The same file is in the repository as deploy/examples/harbor-pilot.yaml.

server ​

KeyDefaultMeaning
listen127.0.0.1:8080Address and port to listen on (host:port).
public_urlhttp://<listen>The address people and tools use, scheme and host only (no path). It sets the cookie origin, the links the CLI prints and the URLs shown in setup steps. https:// turns on Secure, __Host- cookies. When unset it is derived from listen (localhost for a wildcard address, https when TLS is configured).
data_dir./.dataHolds the databases, CLI bridge state and default backups. One server per data directory.
trusted_proxiesnoneCIDRs of reverse proxies whose X-Forwarded-For is believed for the client address. With any set, /metrics always needs a token.
shutdown_timeout30sHow long a graceful shutdown waits for in-flight requests. Must be positive.
metrics_token_filenoneFile holding a bearer token for /metrics. Without one, /metrics answers only direct loopback clients.
tls.cert_file, tls.key_filenoneTerminate TLS in the process. Set both or neither.

security ​

KeyDefaultMeaning
master_key_filenoneFile holding the 32-byte master key, base64 or hex. Must not be readable by group or others. Required outside demo mode, unless HP_MASTER_KEY is set.
previous_master_key_filesnoneOlder master keys, kept only so values sealed with them can still be opened while harbor-pilot keys rotate runs.
secret_rootsnoneDirectories that file: secret references may read. A root may not contain the data directory or a master key file.
secret_env_prefixesHP_SECRET_Prefixes an environment variable needs before an env: secret reference may read it. Each must be at least three characters, and no HP_ prefix other than HP_SECRET_ is allowed.

See Secrets and the master key for how these fit together.

log ​

KeyDefaultMeaning
levelinfodebug, info, warn (or warning) or error. Logs are structured JSON on standard error.

bridges ​

The CLI bridges serve subscription accounts through the vendors' own command-line tools. Each bridge is on when its binary is found.

KeyClaude Code defaultCodex defaultMeaning
binaryclaude on PATHcodex on PATHPath of the vendor CLI.
disabledfalsefalseTurn the bridge off even when the binary is present.
max_processes168Concurrent CLI processes in total.
max_per_account41Concurrent CLI processes per account. Codex refreshes its sign-in in place, so keep it at 1.
idle_timeout10mnot usedHow long a Claude Code process waits for the next turn of its conversation.
tool_timeout30m30mHow long a process waits for your tool to return a tool result.
shelf_max_per_account16not usedClaude Code sessions kept per account after their process ended, so the next turn can continue them with a warm prompt cache. Each is kept at most for its cache lifetime (5 minutes or 1 hour); the oldest go first.
shelf_max_bytes268435456 (256 MiB)not usedTotal size of those kept sessions.

Use bridges.claude_code and bridges.codex as the section names. Bridge state lives under <data_dir>/bridges/. See Subscriptions and CLI bridges.

gateway ​

KeyDefaultMeaning
usage_headersoffauto reports usage to Anthropic Messages clients in anthropic-ratelimit-unified-* response headers, which Claude Code shows in /usage, its status line and its near-limit notice. A Claude subscription seat reports its 5-hour and 7-day windows; other traffic reports the tightest budget that applies, or nothing without one. off sends none of these headers. See Usage headers.

demo ​

KeyDefaultMeaning
enabledfalseServe the synthetic demo (same as --demo).
clocknoneFreeze time at an RFC 3339 instant for repeatable output. Needs demo mode.
allow_publicfalseAllow the demo on a non-loopback address. The demo administrator's password is public, so leave this off.

Environment variables ​

VariableSets
HP_CONFIGPath of the configuration file (--config).
HP_LISTENserver.listen
HP_PUBLIC_URLserver.public_url. Also the default --url of harbor-pilot harness.
HP_DATA_DIRserver.data_dir
HP_MASTER_KEY_FILEsecurity.master_key_file
HP_MASTER_KEYThe master key itself, used when no key file is configured.
HP_SECRET_ENV_PREFIXESsecurity.secret_env_prefixes, comma-separated.
HP_LOG_LEVELlog.level
HP_CLAUDE_BINARYbridges.claude_code.binary
HP_CODEX_BINARYbridges.codex.binary
HP_GATEWAY_USAGE_HEADERSgateway.usage_headers
HP_SERVERServer URL for the API commands (token issue, policy simulate); default http://127.0.0.1:8080.
HP_API_TOKENAPI token for the API commands, when neither --api-token-file nor --api-token-stdin is given.
HP_SECRET_*Not settings: variables with this prefix are what env: secret references may read.

HP_MASTER_KEY and HP_MASTER_KEY_FILE can never be read through a secret reference, whatever the prefixes say.

Command-line flags ​

serve and the offline commands (admin, keys rotate, config validate, doctor, backup, restore, migrate) accept the same overrides:

FlagOverrides
--config FILEConfiguration file
--listen ADDRserver.listen
--data-dir DIRserver.data_dir
--public-url URLserver.public_url
--demodemo.enabled
--demo-clock RFC3339demo.clock
--demo-allow-publicdemo.allow_public

Every command is listed in the command reference.

What is in the data directory ​

PathContents
harbor.dbConfiguration, requests, usage, audit log and encrypted secrets.
traces.dbCaptured content, encrypted, short-lived. Kept apart so it can expire and be excluded from backups.
bridges/CLI bridge working directories and per-account logins.
backups/Default destination of harbor-pilot backup.
demo.db, demo-traces.db, demo-master.keyDemo mode only; the demo never touches harbor.db.

The master key should never be inside the data directory.

Startup checks ​

The server refuses to start when:

  • listen is not host:port, or public_url is not an absolute http(s) URL without a path;
  • only one of tls.cert_file and tls.key_file is set;
  • no master key is configured outside demo mode, or the key file can be read by its group or others;
  • a secret root contains the data directory or a master key file, or a secret prefix is too broad;
  • demo mode would listen on a non-loopback address without allow_public;
  • gateway.usage_headers is not off or auto;
  • the log level is unknown.

harbor-pilot doctor runs the same checks without starting the server, and also reports whether stored secrets were sealed with a master key that is not configured, whether the data directory is writable and which CLI bridges are installed.

Released under the Apache-2.0 License.