This commit is contained in:
Anaïs Saraiva
2026-03-29 19:53:02 +02:00
parent ddebcd6437
commit 75f48591e9
2 changed files with 22 additions and 3 deletions
+5 -2
View File
@@ -1,6 +1,10 @@
import { resolve } from "node:path";
import { z } from "zod";
const normalizedEnv = Object.fromEntries(
Object.entries(Bun.env).map(([key, value]) => [key, value === "" ? undefined : value])
);
const splitList = (value: string | undefined, fallback: string): string[] =>
(value ?? fallback)
.split(",")
@@ -35,7 +39,7 @@ const envSchema = z.object({
TOTP_ENCRYPTION_KEY: z.string().optional()
});
const raw = envSchema.parse(Bun.env);
const raw = envSchema.parse(normalizedEnv);
if ((raw.APP_ADMIN_EMAIL && !raw.APP_ADMIN_PASSWORD) || (!raw.APP_ADMIN_EMAIL && raw.APP_ADMIN_PASSWORD)) {
throw new Error("APP_ADMIN_EMAIL and APP_ADMIN_PASSWORD must be provided together.");
@@ -69,4 +73,3 @@ export const config = {
adminPassword: raw.APP_ADMIN_PASSWORD ?? null,
totpEncryptionKey: raw.TOTP_ENCRYPTION_KEY ?? null
} as const;