Skip to content

Configuration

Both Rust binaries (klaxon-server and klaxon-auth) read config from environment variables with sensible local defaults. Many env vars are shared (DB, CORS, logging, OTel); the IdP and Stripe vars are specific to one binary.

Shared — klaxon-server and klaxon-auth

VariableDefaultDescription
DATABASE_URLpostgres://klaxon:klaxon@localhost:5432/klaxonPostgres connection string
DATABASE_MAX_CONNECTIONS10Max pool connections
LISTEN_ADDR0.0.0.0:3000 server / 0.0.0.0:3001 authBind address
CORS_ORIGINS*Comma-separated allowed origins
RUST_LOGinfotracing EnvFilter
OTEL_ENABLEDfalseEnable OTel export
OTEL_EXPORTER_OTLP_ENDPOINThttp://localhost:4317OTLP/gRPC collector endpoint
OTEL_SERVICE_NAMEklaxon-server / klaxon-authService name in traces
DEPLOYMENT_ENVIRONMENTdevelopmentAttached as deployment.environment resource attr
K8S_POD_NAME / K8S_NAMESPACE_NAMEInjected via downward API in Helm
APP_URLhttp://localhost:5173Public URL of the web UI; used in emails + invitation links

klaxon-server only

VariableDefaultDescription
MAX_BODY_SIZE5242880Max request body in bytes (5 MiB)
REDIS_URLRedis connection for rate limiting; Postgres fallback if unset
RATE_LIMIT_PER_MINUTE60Requests per minute per agent/user
RESOURCE_URLAPP_URLPublic URL of the resource — used in WWW-Authenticate: Bearer resource_metadata="…"
ISSUER_URLPublic URL of the AS — used when validating tokens against the AS
FCM_SERVICE_ACCOUNT_JSONFirebase service-account key (JSON). Needed for mobile + Web Push
STRIPE_SECRET_KEYsk_live_… / sk_test_…; unset disables billing endpoints
STRIPE_WEBHOOK_SECRETwhsec_… for /webhooks/stripe HMAC verification
STRIPE_PRICE_TEAMStripe Price ID for the Team plan
STRIPE_PRICE_ENTERPRISEStripe Price ID for the Enterprise plan

klaxon-auth only

VariableDefaultDescription
ISSUER_URLrequiredPublic URL of the AS — issuer in OAuth discovery
RESOURCE_URLrequiredPublic URL of klaxon-server — the aud hint in WWW-Authenticate
OAUTH_SIGNING_KEYrequired32+ random bytes (openssl rand -base64 32). Signs the browser session cookie + OAuth state param
DEV_LOGIN_ENABLEDfalseEnable POST /auth/login dev bypass — never set in production
SMTP_HOST / SMTP_PORT / SMTP_USER / SMTP_PASS / SMTP_FROMport 587, from noreply@klaxon.shMagic-link delivery
RESEND_API_KEYResend API key for invitation emails; falls back to logging if unset
KLAXON_INVITE_FROM_ADDRESSinvites@klaxon.shFrom: address for Resend invites
GITHUB_CLIENT_ID / GITHUB_CLIENT_SECRETGitHub OAuth
GOOGLE_CLIENT_ID / GOOGLE_CLIENT_SECRETGoogle OAuth
APPLE_CLIENT_ID / APPLE_TEAM_ID / APPLE_KEY_ID / APPLE_PRIVATE_KEYSign in with Apple (ES256)

.env File

The server loads .env automatically via dotenvy:

bash
# .env
DATABASE_URL=postgres://klaxon:klaxon@localhost:5432/klaxon
RUST_LOG=info,klaxon_server=debug
CORS_ORIGINS=http://localhost:5173,http://localhost:1420

Runtime Settings

Some settings are stored in the database settings table (per-org, JSONB values) and can be changed at runtime without restarting the server:

KeyTypeDefaultDescription
auto_archive_after_daysint0Auto-archive old items (0 = disabled)
audit_retention_daysint0Purge audit entries older than N days
archived_item_retention_daysint0Hard-delete archived items older than N days
stale_warning_daysint0Flag items older than N days as stale

These are checked by the background worker on each sweep cycle.

CORS

In production, set CORS_ORIGINS to your actual frontend origins:

bash
CORS_ORIGINS=https://app.klaxon.sh,https://klaxon.sh

Using * (the default) allows all origins — fine for development, not recommended for production.

Logging

The server outputs structured JSON logs:

json
{ "timestamp": "2026-04-10T03:00:00Z", "level": "INFO", "message": "listening on 0.0.0.0:3000" }

Use RUST_LOG for granular control:

bash
RUST_LOG=warn,klaxon_server=debug,sqlx=info