Environment Variable Patterns
Keeptrusts does not use one universal *_env rule across every config surface. Keeptrusts uses three distinct patterns today:
secret_key_ref: { env: ... }for many secretssecret_key_ref: { store: ... }for provider targets that resolve from hosted secret records- A small set of literal
*_envfields such aspublic_key_env,secret_key_env, andurl_env
Provider authentication
Provider targets support both environment-backed refs and hosted secret-store refs.
providers:
targets:
- id: openai-local
provider: openai
model: your-openai-model
secret_key_ref:
env: KEEPTRUSTS_OPENAI_API_KEY
- id: openai-hosted
provider: openai
model: your-openai-model
secret_key_ref:
store: KEEPTRUSTS_OPENAI_API_KEY
secret_key_ref.envis resolved from the gateway process environment.secret_key_ref.storeis accepted on provider targets and resolved by name through the connected gateway's hosted secret resolver. Create and manage the record withkt secret; the retired config-variable API is not this workflow.- Prefer a Keeptrusts-prefixed name such as
KEEPTRUSTS_OPENAI_API_KEYfor provider credentials. The reference is explicit—the gateway does not infer a provider credential from a conventional ambient name such asOPENAI_API_KEY. - Provider targets may omit
secret_key_refand still pass parsing. An ordinary auth-required target then remains inactive because no credential resolves; auth-optional and self-credentialed provider types use their own documented authentication path.
Env-only secret surfaces
These config surfaces currently reject secret_key_ref.store and only accept env-backed secrets:
| Surface | Supported shape |
|---|---|
policy.flagged-review.provider.secret_key_ref | secret_key_ref: { env: ... } |
policy.external-moderation.secret_key_ref | secret_key_ref: { env: ... } |
tool_validation.semantic_validation.secret_key_ref | secret_key_ref: { env: ... } |
tool_security.secret_key_ref | secret_key_ref: { env: ... } |
If you pass store on one of those surfaces, config validation returns ...store is not supported in this config surface.
Callback-specific env fields
Callback config supports a mix of env-name fields and literal fallbacks:
| Callback type | Env-backed fields |
|---|---|
langfuse | public_key_env, secret_key_env |
datadog | secret_key_ref.env |
helicone | secret_key_ref.env |
braintrust | secret_key_ref.env |
prometheus | No credential field |
Example:
callbacks:
- type: langfuse
host: https://cloud.langfuse.com
public_key_env: KEEPTRUSTS_LANGFUSE_PUBLIC_KEY
secret_key_env: KEEPTRUSTS_LANGFUSE_SECRET_KEY
- type: datadog
secret_key_ref:
env: KEEPTRUSTS_DATADOG_API_KEY
site: datadoghq.com
The schema currently accepts a webhook callback and its
signing_secret_env field, but the gateway callback router does not implement
that callback type. It skips the entry as unknown and does not read the signing
secret. Do not configure webhook callbacks until the runtime implements them.
Distributed rate-limit backend env fields
Use the top-level distributed_rate_limit: block. Internal parser paths also
recognize nested distributed: blocks, but the published schema and
kt policy lint reject those placements. Runtime dispatch only builds a shared
counter for global_rate_limit; it does not create distributed IP or token
counters.
distributed_rate_limit:
backend: redis
url_env: KEEPTRUSTS_LLM_CACHE_REDIS_URL
If url_env is omitted, config loading defaults to KEEPTRUSTS_LLM_CACHE_REDIS_URL.
Execution-target env maps
Execution targets use cli_env and adapter_env as literal key/value maps. Config loading does not expand ${VAR} placeholders inside these maps.
providers:
targets:
- id: browser-runner
provider: browser
adapter_command: /usr/local/bin/keeptrusts-browser-adapter
cli_env:
LOG_LEVEL: debug
adapter_env:
LOG_LEVEL: info
PLAYWRIGHT_BROWSERS_PATH: /opt/playwright
Important behavior note:
- values are copied as literal strings
- on duplicate keys,
adapter_envcurrently overwritescli_env
Cloud/account-id helper fields
A few integrations use dedicated env-name fields instead of secret_key_ref:
cloudflare_account_id_envsnowflake_account_identifier_envpublic_key_envsecret_key_envurl_env
Treat these as field-specific exceptions, not as proof of a universal *_env convention.
Hosted secret-store references
secret_key_ref.store names are resolved through the hosted secret API for a
connected gateway. Use provider targets for this pattern, and create the named
record with kt secret.
providers:
targets:
- id: shared-openai
provider: openai
model: your-openai-model
secret_key_ref:
store: KEEPTRUSTS_OPENAI_API_KEY
Replace your-openai-model with a model identifier available to your OpenAI
account.
export KEEPTRUSTS_OPENAI_API_KEY="<provider-key>"
kt secret create \
--name KEEPTRUSTS_OPENAI_API_KEY \
--env-var KEEPTRUSTS_OPENAI_API_KEY
The gateway runtime token used to fetch a connected configuration and resolve its bound secrets is separate from the provider value stored in this record.