feat(backend): pin server timezone to UTC with startup assertion
Belt-and-suspenders, not a bug fix: storage (timestamptz) and timer math are already tz-independent. Add SERVER_TZ env (default UTC) via getServerTimezone(); db/client.js pins the DB session timezone (reads env directly to avoid an import cycle); server.js pins process.env.TZ and asserts at boot that the DB session matches (logs [tz] or a loud warning). Keeps any future date_trunc/::date reporting deterministic and surfaces a misconfigured server early. Documented in backend/CLAUDE.md + .env.example. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,12 @@ INTERNAL_HOST=127.0.0.1
|
||||
# Database
|
||||
DATABASE_URL=postgresql://user:password@localhost:5432/halobestie
|
||||
|
||||
# Server timezone. Pins the DB session + Node process to one zone. Leave as UTC
|
||||
# in all environments — storage (timestamptz) and timer math are tz-independent,
|
||||
# this just keeps any future date_trunc/::date-style SQL deterministic. The
|
||||
# backend asserts the DB session matches this at startup.
|
||||
SERVER_TZ=UTC
|
||||
|
||||
# Valkey / Redis
|
||||
VALKEY_URL=redis://localhost:6379
|
||||
|
||||
|
||||
Reference in New Issue
Block a user