Skip to content

Commit

Permalink
use env var for recaptcha
Browse files Browse the repository at this point in the history
  • Loading branch information
Woozl committed Jun 6, 2023
1 parent 8ad2b37 commit 765f4d2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
2 changes: 1 addition & 1 deletion src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default function RootLayout({
}) {
return (
<html lang="en">
<RecaptchaProvider publicKey='6LcMQR4lAAAAAB5Ilnu7XYiXyb3uY7mHh44fhBk0'>
<RecaptchaProvider publicKey={process.env.NEXT_PUBLIC_RECAPTCHA_KEY}>
<body className={roboto.className}>{children}</body>
</RecaptchaProvider>
</html>
Expand Down
6 changes: 5 additions & 1 deletion src/providers/recaptcha-context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<string>) | null>(null);

const onScriptLoad = () => {
Expand Down

0 comments on commit 765f4d2

Please sign in to comment.