mirror of
https://github.com/temetro/temetro.git
synced 2026-08-18 14:23:14 +00:00
Fix Docker runtime: secure cookies over HTTP and empty env vars
- useSecureCookies now keys off the BETTER_AUTH_URL scheme instead of NODE_ENV, so login works over http://localhost in the (production-mode) Docker stack instead of the browser silently dropping the session cookie. - env parsing treats empty strings as unset, so compose-supplied optionals like `SMTP_PORT=` no longer fail coercion (Number("") === 0) and crash boot. - docker-compose: configurable host Postgres port (POSTGRES_PORT) to avoid clashing with an existing local Postgres. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+8
-1
@@ -23,7 +23,14 @@ const schema = z.object({
|
||||
SMTP_FROM: z.string().default("temetro <no-reply@temetro.local>"),
|
||||
});
|
||||
|
||||
const parsed = schema.safeParse(process.env);
|
||||
// docker compose passes unset optionals as empty strings (e.g. `${SMTP_PORT:-}`).
|
||||
// Treat empty strings as "unset" so optionals/defaults apply instead of failing
|
||||
// coercion (e.g. Number("") === 0).
|
||||
const rawEnv = Object.fromEntries(
|
||||
Object.entries(process.env).map(([k, v]) => [k, v === "" ? undefined : v]),
|
||||
);
|
||||
|
||||
const parsed = schema.safeParse(rawEnv);
|
||||
|
||||
if (!parsed.success) {
|
||||
const lines = parsed.error.issues
|
||||
|
||||
Reference in New Issue
Block a user