aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/env.ts
diff options
context:
space:
mode:
authorSebastien Castiel <sebastien@castiel.me>2024-01-30 16:36:29 -0500
committerGitHub <noreply@github.com>2024-01-30 16:36:29 -0500
commit4a9bf575bd24b2e24348c65d9fbbf9c81a73cb35 (patch)
tree364cb36ea89d8023676140ed2fdd166c3b1fd602 /src/lib/env.ts
parent9e300e0ff0c9d93cbaeaa86c1e2a560523107382 (diff)
Create expense from receipt (#69)
* Create expense from receipt * Add modal * Update README
Diffstat (limited to 'src/lib/env.ts')
-rw-r--r--src/lib/env.ts9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/lib/env.ts b/src/lib/env.ts
index 9912945..33b835d 100644
--- a/src/lib/env.ts
+++ b/src/lib/env.ts
@@ -17,6 +17,8 @@ const envSchema = z
S3_UPLOAD_SECRET: z.string().optional(),
S3_UPLOAD_BUCKET: z.string().optional(),
S3_UPLOAD_REGION: z.string().optional(),
+ NEXT_PUBLIC_ENABLE_RECEIPT_EXTRACT: z.coerce.boolean().default(false),
+ OPENAI_API_KEY: z.string().optional(),
})
.superRefine((env, ctx) => {
if (
@@ -32,6 +34,13 @@ const envSchema = z
'If NEXT_PUBLIC_ENABLE_EXPENSE_DOCUMENTS is specified, then S3_* must be specified too',
})
}
+ if (env.NEXT_PUBLIC_ENABLE_RECEIPT_EXTRACT && !env.OPENAI_API_KEY) {
+ ctx.addIssue({
+ code: ZodIssueCode.custom,
+ message:
+ 'If NEXT_PUBLIC_ENABLE_RECEIPT_EXTRACT is specified, then OPENAI_API_KEY must be specified too',
+ })
+ }
})
export const env = envSchema.parse(process.env)