Commit graph

4 commits

Author SHA1 Message Date
5ac62ec2db Support PostgreSQL configured from the environment
Sessions, password reset tokens and pending registrations live in the
database, so running more than one replica needs a shared one. With
DATABASE_HOST set the app uses PostgreSQL (psycopg 3 binary wheels, no
system libraries) with persistent, health-checked connections.
Otherwise SQLite is used, at a path configurable with SQLITE_PATH so a
single replica can keep it on a volume.

docker-compose.dev.yml gains a PostgreSQL 18 service on
localhost:5433. The full test suite passes on SQLite and PostgreSQL.
2026-11-06 15:31:01 +03:00
d433708f86 Add production HTTPS and proxy settings
- Session and CSRF cookies are secure-only unless DEBUG is on.
- TRUST_X_FORWARDED_PROTO honours X-Forwarded-Proto from a TLS
  terminating ingress. Without it, Django 4+ fails the CSRF origin
  check on every form POST.
- CSRF_TRUSTED_ORIGINS, SECURE_SSL_REDIRECT and SECURE_HSTS_SECONDS are
  configurable and off by default. HSTS for subdomains and preload are
  left to ungleich, since they affect all of *.ungleich.ch.
2026-11-06 15:27:27 +03:00
122bc387d8 Time out requests to the OTP server
None of the calls to the OTP server set a timeout, so a hanging OTP
server blocked a web worker indefinitely. Each call now times out after
OTP_TIMEOUT seconds (default 10).
2026-11-06 15:26:48 +03:00
f8567b2a41 Read all configuration in settings and document it in env.sample
The OTP server variables were read straight from the environment in
views.py. They are now OTP_* settings next to everything else, under
the same environment variable names, so existing deployments are
unaffected.

Remove LDAP_SERVER and LDAP_USERS_DN, which nothing used.
env.sample moves to the repository root (where .env is read from) and
lists every variable settings.py reads, including defaults and which
values are secrets.
2026-11-06 15:26:26 +03:00