Skip to content

Environment variables

Klokk is configured through environment variables at start-up. Everything that belongs to day-to-day operation — companies, people, rules, retention — is set in Klokk itself under Admin, not here.

Without these Klokk does not start:

Variable Purpose
ACCEPT_TERMS Required true accepts the terms of use.
SESSION_SECRET Required Signs sessions and links (at least 32 characters, random).
CSRF_KEY Required Protects forms against cross-site requests (at least 32 characters, random).
DATA_KEY Required Encrypts the database — never change or lose it.

Generate each once with openssl rand -hex 32, as in the quick start.

With Docker Compose, put them in an env_file or under environment:; with docker run, use --env-file or -e. Changes take effect when the container is recreated (docker compose up -d).

Every variable can also come from a file — for example a Docker secret. <NAME>_FILE names the file; its content (without surrounding white space) is the value:

docker-compose.yml (excerpt)
services:
klokk:
environment:
DATA_KEY_FILE: /run/secrets/klokk_data_key
SMTP_PASS_FILE: /run/secrets/smtp_pass
secrets: [klokk_data_key, smtp_pass]
secrets:
klokk_data_key:
file: ./secrets/data_key
smtp_pass:
file: ./secrets/smtp_pass

Setting both NAME and NAME_FILE, or a file Klokk cannot read, stops the start — so a typo never goes unnoticed.