From 765f4d29a39c9b1383e5d6d5aa5c8d0c7b0b1893 Mon Sep 17 00:00:00 2001 From: David Glymph Date: Tue, 6 Jun 2023 14:43:55 -0400 Subject: [PATCH] use env var for recaptcha --- README.md | 10 ++++++---- src/app/layout.tsx | 2 +- src/providers/recaptcha-context.tsx | 6 +++++- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index ef1ee51..9dd1a1c 100644 --- a/README.md +++ b/README.md @@ -26,8 +26,10 @@ docker run --rm -p 80:3000 containers.renci.org/translator/landing-page:2.0.0 ## Kubernetes Deploy -First, ensure the image is in the RENCI registry +The site is built by a Github Action script on each new release, and pushed to the Github Container Registry at: -```bash -docker push containers.renci.org/translator/landing-page:2.0.0 -``` +[ghcr.io/robokopu24/robokopu24.github.io](https://ghcr.io/robokopu24/robokopu24.github.io) + +### Environment Variables + +Ensure that the `NEXT_PUBLIC_RECAPTCHA_KEY` is set. For development, create a `.env.local` diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 532db6c..e19a1c5 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -17,7 +17,7 @@ export default function RootLayout({ }) { return ( - + {children} diff --git a/src/providers/recaptcha-context.tsx b/src/providers/recaptcha-context.tsx index 13103b2..a88edbb 100644 --- a/src/providers/recaptcha-context.tsx +++ b/src/providers/recaptcha-context.tsx @@ -30,11 +30,15 @@ export const useRecaptchaContext = () => { }; interface RecaptchaProviderProps { - publicKey: string; + publicKey?: string; children: React.ReactNode; } export const RecaptchaProvider = ({ publicKey, children }: RecaptchaProviderProps) => { + if (!publicKey) { + throw new Error("RecaptchaProvider missing public key"); + } + const [execute, setExecute] = useState<((action: string) => Promise) | null>(null); const onScriptLoad = () => {