fix hardcoded cf site key thingie, now a env

This commit is contained in:
2026-01-21 15:41:33 +05:00
parent 5ac3e8bec4
commit 13614a18f7
4 changed files with 8 additions and 3 deletions

View File

@@ -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:

View File

@@ -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

1
.gitignore vendored
View File

@@ -8,3 +8,4 @@ riderModule.iml
/.vs/ProjectEvaluation
/Submission.Api/Petitions
/Submission.Api/appsettings.json
.env

View File

@@ -256,7 +256,7 @@ export function SignatureForm({ language, onSubmit }: SignatureFormProps) {
{/* Turnstile and Submit */}
<div className="flex flex-col items-center sm:items-start gap-4">
<Turnstile
siteKey="0x4AAAAAACHH4QC3wIhkCuhd"
siteKey={import.meta.env.VITE_TURNSTILE_SITEKEY}
onSuccess={setTurnstileToken}
onError={() => setTurnstileToken(null)}
onExpire={() => setTurnstileToken(null)}