Configuration
Configuration is environment variables only — there is no config file. The
canonical list, with the reasoning, is .env.example in the repo, which names
every variable and the code that reads it; this page is the same set arranged
for looking things up.
Required — Ward will not start without these
WARD_SIGNING_KEY_PATH- The Ed25519 private key. Mode
0600, generated once on the server and never by a deploy. WARD_ADMIN_USERNAME- The break-glass superuser's name.
WARD_ADMIN_PASSWORD- Its password.
openssl rand -base64 32. WARD_PUBLIC_ORIGIN- Scheme + host, no path, no trailing slash. Becomes the
issclaim.
Refusing to boot without the admin credential is deliberate: it is the only credential that still works when the database is empty or has lost its last admin, so a service that started without one could be locked out of itself.
All variables
| Variable | Read by | Notes |
|---|---|---|
PORT | the listener | Bound on 127.0.0.1 only. Caddy is the sole way in. |
WARD_TRUSTED_PROXIES | the login lockout | Optional; unset trusts loopback only. Required in practice in a container. See Trusted proxies. |
WARD_DB_PATH | the connection | The only copy of who anybody is. See the WAL warning below. |
WARD_SIGNING_KEY_PATH | key loading | Required. |
WARD_ADMIN_USERNAME | console session | Required. |
WARD_ADMIN_PASSWORD | console session | Required. |
WARD_PUBLIC_ORIGIN | token minting (iss), UI redirects | Required. |
WARD_MAIL_TRANSPORT | api/src/mail/ | file or smtp. |
WARD_MAIL_FILE_DIR | file transport | Required when transport is file. |
WARD_MAIL_FROM | both transports | Required in both modes. |
WARD_SMTP_HOST | smtp transport | Required when transport is smtp. |
WARD_SMTP_PORT | smtp transport | |
WARD_SMTP_USER | smtp transport | |
WARD_SMTP_PASSWORD | smtp transport | |
WARD_OIDC_ISSUER | api/src/oidc/ | Optional; unset, the OpenID Connect provider is off. The issuer as the browser sees it, ending in /oidc. See Sign in with Ward. |
WARD_UI_URL | api/src/oidc/ | Required with the issuer. Ward's UI on the same origin. |
Trusted proxies
The login lockout counts failures per client address, and Ward only learns
that address from Caddy's X-Forwarded-For. It believes the header only when
the socket peer is a proxy it trusts, and then reads only the last
element, the one Caddy appended. Anything a client wrote earlier in the header
is never read.
Loopback is always trusted. WARD_TRUSTED_PROXIES adds more: comma-separated
addresses or CIDR ranges, IPv4 or IPv6. An IPv4-mapped peer
(::ffff:172.19.0.3) matches an IPv4 range.
Host Caddy reaches a container through Docker's proxy, so the peer Ward sees
is a Docker bridge address, never loopback. With nothing listed, every request
keys on that one address, and five bad passwords from anyone lock everyone out
of /login for 15 minutes. Use Docker's default 172.16.0.0/12 unless the
stack pins a subnet, and confirm it on the host with
docker network inspect <network> --format '{{range .IPAM.Config}}{{.Subnet}}{{end}}'.
A malformed entry, host bits set past the prefix (172.19.0.3/16), or a /0
stops the boot and names the entry. Two misconfigurations are logged as
throttled warnings: a trusted peer that forwarded no address, and an
X-Forwarded-For from an untrusted peer, which is what a proxy missing from
the list looks like.
Apps on the shared library set AUTH_TRUSTED_PROXIES the same way.
The signing key
One Ed25519 private key signs Ward's own access tokens and every ID token the OpenID Connect provider issues to an app.
- Not in the repo, and not in
.env..gitignoreexcludes*.pem,*.keyandapi/data/— belt and braces, because a singlegit add -Acommitting it means rotating estate-wide and scrubbing history. - Created once on the server, backed up, and never regenerated by a deploy. A new key signs the whole estate out at once and reads as an outage rather than as a rotation.
- Apps only ever see the public half, over the provider's
/oidc/jwks(the same key as/.well-known/jwks.json).
The database
WARD_DB_PATH holds accounts, credentials, sessions and grants.
ward.db aloneWAL mode means committed data lives in the -wal sidecar until a checkpoint.
Copying ward.db on its own can produce a file that is missing recent commits
while looking entirely valid. See Data model.
Mail
file writes each message to WARD_MAIL_FILE_DIR instead of sending, so the
registration and verification flow is exercisable locally with no SMTP server.
The directory is gitignored, and that is a security measure rather than tidiness: a verification mail holds a single-use token, so those files are credentials on disk, not logs.
What the deploy sets for each app
An app is configured as an OpenID Connect client of Ward, not with any Ward
secret. vps-deploy writes the same set into every app that signs in through
Ward:
| Variable | Value |
|---|---|
WARD_OIDC_ISSUER | Ward's external issuer, ending in /oidc |
WARD_OIDC_CLIENT_ID | the app's slug at Ward |
WARD_OIDC_CLIENT_KEY | the app's private JWK, from its own secrets/<app>.env |
WARD_OIDC_REDIRECT_URI | the app's callback |
WARD_OIDC_POST_LOGOUT_REDIRECT_URI | where "sign out of Ward too" returns |
AUTH_TRUSTED_PROXIES | the same list Ward's own lockout trusts |
plus the app's own public origin. Reading Ward's identity in the deploy repo registers the deploy-order edge as a side effect, so an app cannot be configured as a client without also being ordered after Ward. A missing client key is named by preflight against the right file, rather than surfacing as a failed sign-in after a green deploy.
The variables of the retired cookie contract (WARD_APP_KEY,
WARD_API_BASE_PATH, and an app-side WARD_PUBLIC_ORIGIN) are no longer
written or read; an app's env file that still carries them can drop them.
See Sign in with Ward and the shared library's
adoption guide (shared-library/README.md in the repo) for what an app does
with them.