diff --git a/README.md b/README.md index 28fe10b..15b29bc 100644 --- a/README.md +++ b/README.md @@ -17,3 +17,11 @@ Open [http://localhost:3000](http://localhost:3000) with your browser to see the ## Deploy The app is based on [Next.JS](https://nextjs.org/) and is automatically built & deployed to GitHub Pages when pushing to the `main` branch. + +## Internal Server Configuration + +This app supports overriding of the default rekor server instance for those running private instances of the the sigstore stack. +Create a `.env.local` file at the root and include in it this environment variable +```properties +NEXT_PUBLIC_REKOR_DEFAULT_DOMAIN=https://privaterekor.sigstore.dev +``` \ No newline at end of file diff --git a/src/modules/api/context.tsx b/src/modules/api/context.tsx index e849fd6..ee36ccf 100644 --- a/src/modules/api/context.tsx +++ b/src/modules/api/context.tsx @@ -24,6 +24,10 @@ export const RekorClientProvider: FunctionComponent> = ({ const [baseUrl, setBaseUrl] = useState(); const context: RekorClientContext = useMemo(() => { + if (baseUrl === undefined && process.env.NEXT_PUBLIC_REKOR_DEFAULT_DOMAIN) { + setBaseUrl(process.env.NEXT_PUBLIC_REKOR_DEFAULT_DOMAIN) + } + return { client: new RekorClient({ BASE: baseUrl }), baseUrl, diff --git a/src/modules/components/Settings.tsx b/src/modules/components/Settings.tsx index 05642df..4ab2ac2 100644 --- a/src/modules/components/Settings.tsx +++ b/src/modules/components/Settings.tsx @@ -30,6 +30,10 @@ export function Settings({ }, []); const onSave = useCallback(() => { + if (localBaseUrl === undefined && process.env.NEXT_PUBLIC_REKOR_DEFAULT_DOMAIN){ + setLocalBaseUrl(process.env.NEXT_PUBLIC_REKOR_DEFAULT_DOMAIN); + } + setBaseUrl(localBaseUrl); onClose(); }, [localBaseUrl, setBaseUrl, onClose]); @@ -49,7 +53,7 @@ export function Settings({ Override rekor endpoint