.
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user