From 13614a18f7ce0a0699a2144c3bbd30795ed5d7a5 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Wed, 21 Jan 2026 15:41:33 +0500 Subject: [PATCH] fix hardcoded cf site key thingie, now a env --- .build/prod/compose.yml | 2 ++ .build/prod/frontend.Dockerfile | 6 ++++-- .gitignore | 1 + frontend-react/src/components/signature/SignatureForm.tsx | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.build/prod/compose.yml b/.build/prod/compose.yml index 9158ea0..99f2a9c 100644 --- a/.build/prod/compose.yml +++ b/.build/prod/compose.yml @@ -10,6 +10,8 @@ services: build: context: ../../ dockerfile: .build/prod/frontend.Dockerfile + args: + VITE_TURNSTILE_SITEKEY: ${VITE_TURNSTILE_SITEKEY} hostname: frontend image: git.shihaam.dev/mvdevsunion/wpetition/frontend depends_on: diff --git a/.build/prod/frontend.Dockerfile b/.build/prod/frontend.Dockerfile index da46658..65edfdd 100644 --- a/.build/prod/frontend.Dockerfile +++ b/.build/prod/frontend.Dockerfile @@ -1,6 +1,8 @@ # Build stage - compile the React/Vite app FROM node:20-alpine AS builder +ARG VITE_TURNSTILE_SITEKEY + WORKDIR /app # Copy package files first for better caching @@ -12,8 +14,8 @@ RUN npm ci # Copy source files COPY frontend-react/ ./ -# Build the production bundle -RUN npm run build +# Build the production bundle with env vars baked in +RUN VITE_TURNSTILE_SITEKEY=$VITE_TURNSTILE_SITEKEY npm run build # Production stage - serve with Nginx FROM nginx:alpine diff --git a/.gitignore b/.gitignore index ea6e644..7fc3570 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ riderModule.iml /.vs/ProjectEvaluation /Submission.Api/Petitions /Submission.Api/appsettings.json +.env diff --git a/frontend-react/src/components/signature/SignatureForm.tsx b/frontend-react/src/components/signature/SignatureForm.tsx index 08b63e7..3fc8940 100644 --- a/frontend-react/src/components/signature/SignatureForm.tsx +++ b/frontend-react/src/components/signature/SignatureForm.tsx @@ -256,7 +256,7 @@ export function SignatureForm({ language, onSubmit }: SignatureFormProps) { {/* Turnstile and Submit */}
setTurnstileToken(null)} onExpire={() => setTurnstileToken(null)}