Configure.

Every setting, from flags, environment variables, a TOML file, or defaults, and how secrets stay out of process lists.

Settings come from, in order of precedence: flags, then TENSILE_AUTH_ environment variables, then a TOML file, then defaults. --config or TENSILE_AUTH_CONFIG names the file.

  • Variables. Each key maps to TENSILE_AUTH_ and its path in upper case, with __ between sections. For example, passwords.mailer_url is TENSILE_AUTH_PASSWORDS__MAILER_URL. A list is comma-separated.
  • Flags. Each key maps to a flag: its path with _ replaced by -, for example --ops-listen.
  • Secrets. database_url, master_key, passwords.mailer_url, and rate_limits.backend can be read from a file with the _FILE suffix, for example TENSILE_AUTH_MASTER_KEY_FILE=/run/secrets/master_key. Their flags take only the file form, such as --master-key-file, so a secret never appears in a process list.
  • Unknown keys stop the server. A key in the file, or a TENSILE_AUTH_ variable, that matches no setting is refused, so a misspelled setting fails at startup instead of being ignored.

To check a configuration without serving, run tensile-auth-server check. It runs every startup check, including the database and the master key, and exits with 0 or 1.

Key Default Meaning
database_url None; required A postgres:// URL, or sqlite:///absolute/path for a single node
origins None; required The app’s public origins, for example https://app.example.com. Each must use https://, except on localhost
rp_id The host of the first origin The passkey relying party ID. It must be the host of every origin or a parent domain of it, and contain a dot
rp_name rp_id The name some authenticators show
master_key None; required 32 random bytes in standard base64
listen :8080 The API listener
ops_listen :9090 The ops port, which serves /livez and /readyz. It must differ from listen
trusted_proxies Empty CIDRs whose X-Forwarded-For the server trusts for the client’s address
preset standard@1 The preset that sets the sign-in methods and session lengths. tensile-auth-preset -all lists them
migrate auto auto, check, or off; see Upgrade
shutdown_timeout 8s How long in-flight requests get after SIGTERM
passwords.enabled true false serves passkeys only; set preset to passkey-only@1 with it
passwords.mailer_url None Required with passwords: an smtp:// or smtps:// URL, or an https:// webhook to the app
passwords.accept_bcrypt false Verifies bcrypt hashes imported from another product, and replaces each with Argon2id at its first sign-in
cache.enabled true On Postgres, caches token lookups and clears every replica’s cache through LISTEN/NOTIFY
rate_limits.backend postgres on Postgres, memory on SQLite postgres, memory for a single node, or a redis:// or rediss:// URL
sessions.default_scopes Empty The scopes of every session when no hook sets them
hooks.url None The app’s endpoint for the sign-up and session scopes hooks
webhooks.url None The app’s endpoint for events
admin.allowed_networks Empty, which allows any CIDRs whose clients may reach /admin/
oauth.enabled false Mounts the OAuth and OpenID Connect provider; see OAuth
log.format json json or text

A configuration file looks like this. Keep secrets out of it and pass them with _FILE variables:

TOML
origins = ["https://app.example.com"]
preset = "passkey-only@1"
trusted_proxies = ["10.0.0.0/8"]

[passwords]
enabled = false

[webhooks]
url = "https://app.example.com/hooks/auth"