From 2af066038351ab0634c359a688fe712a539992b4 Mon Sep 17 00:00:00 2001 From: Jan T Date: Wed, 14 Feb 2024 17:18:30 +0200 Subject: Optimize docker image size (#91) * Move prisma to runtime dependencies * Optimize Dockerfile and build script * Fix: remove mention of generated next-env.d.ts in Dockerfile * Add missing reset.d.ts file to Dockerfile * Remove compression steps from Dockerfile and entrypoint script * Add an env file with mocked env vars added for Docker production builds * Use server actions to get runtime env vars * Refactor types and names * Rollback serverActions, use parsed Zod object for runtime env * Reintroduce featureFlags object to avoid passing secret envs to the frontend * Improve string to boolean coercion Co-authored-by: Sebastien Castiel * Run prettier autoformat * Fix type issue, rename function to match behaviour better --------- Co-authored-by: Lauri Vuorela Co-authored-by: Sebastien Castiel --- src/lib/featureFlags.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/lib/featureFlags.ts (limited to 'src/lib/featureFlags.ts') diff --git a/src/lib/featureFlags.ts b/src/lib/featureFlags.ts new file mode 100644 index 0000000..e57ca9c --- /dev/null +++ b/src/lib/featureFlags.ts @@ -0,0 +1,15 @@ +'use server' + +import { env } from './env' + +export async function getRuntimeFeatureFlags() { + return { + enableExpenseDocuments: env.NEXT_PUBLIC_ENABLE_EXPENSE_DOCUMENTS, + enableReceiptExtract: env.NEXT_PUBLIC_ENABLE_RECEIPT_EXTRACT, + enableCategoryExtract: env.NEXT_PUBLIC_ENABLE_CATEGORY_EXTRACT, + } +} + +export type RuntimeFeatureFlags = Awaited< + ReturnType +> -- cgit v1.3