From 45ade984a37bef4762242c5341ec1418b943399b Mon Sep 17 00:00:00 2001 From: Pete Gadomski Date: Wed, 14 Jan 2026 06:43:47 -0700 Subject: [PATCH 1/2] fix: slight customizations for white-label deployment --- README.md | 24 ++++++++++++++++++++++++ src/hooks/href-param.ts | 2 +- vite.config.ts | 2 +- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8d37545..1adcf53 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,30 @@ This requires our commit messages to conform to [Conventional Commits](https://w See [deploy.yaml](./.github/workflows/deploy.yaml) for a (drop-dead simple) example of deploying this application as a static site via Github Pages. +### White-label deployment + +You can deploy your own customized version of stac-map using environment variables: + +| Variable | Description | Default | +|----------|-------------|---------| +| `VITE_BASE_PATH` | URL path prefix (e.g., `/my-app/`) | `/stac-map/` | +| `VITE_DEFAULT_HREF` | STAC resource to load on startup | None (shows intro) | + +Example: + +```shell +VITE_BASE_PATH=/ VITE_DEFAULT_HREF=https://my-stac-api.com yarn build +``` + +Or create a `.env` file: + +```shell +VITE_BASE_PATH=/ +VITE_DEFAULT_HREF=https://my-stac-api.com +``` + +Then run `yarn build` and deploy the `dist/` directory to your static hosting provider. + ## Versioning For now, we use a form of [Sentimental Versioning](https://github.com/dominictarr/sentimental-versioning#readme), where we use MAJOR, MINOR, and PATCH versions to communicate the "weight" of changes. diff --git a/src/hooks/href-param.ts b/src/hooks/href-param.ts index 686f28a..3d3521a 100644 --- a/src/hooks/href-param.ts +++ b/src/hooks/href-param.ts @@ -5,7 +5,7 @@ function getCurrentHref(): string { } function getInitialHref(): string | undefined { - const href = getCurrentHref(); + const href = getCurrentHref() || import.meta.env.VITE_DEFAULT_HREF || ""; try { new URL(href); } catch { diff --git a/vite.config.ts b/vite.config.ts index 133176e..ff99caf 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -6,6 +6,6 @@ import tsconfigPaths from "vite-tsconfig-paths"; // https://vite.dev/config/ export default defineConfig({ - base: "/stac-map/", + base: process.env.VITE_BASE_PATH || "/stac-map/", plugins: [react(), tsconfigPaths(), wasm(), topLevelAwait()], }); From 8c2351425dadbde29af0f680a2101d2e1ff16049 Mon Sep 17 00:00:00 2001 From: Pete Gadomski Date: Wed, 14 Jan 2026 06:48:10 -0700 Subject: [PATCH 2/2] fix: formatting --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 1adcf53..fc9a9ca 100644 --- a/README.md +++ b/README.md @@ -64,10 +64,10 @@ See [deploy.yaml](./.github/workflows/deploy.yaml) for a (drop-dead simple) exam You can deploy your own customized version of stac-map using environment variables: -| Variable | Description | Default | -|----------|-------------|---------| -| `VITE_BASE_PATH` | URL path prefix (e.g., `/my-app/`) | `/stac-map/` | -| `VITE_DEFAULT_HREF` | STAC resource to load on startup | None (shows intro) | +| Variable | Description | Default | +| ------------------- | ---------------------------------- | ------------------ | +| `VITE_BASE_PATH` | URL path prefix (e.g., `/my-app/`) | `/stac-map/` | +| `VITE_DEFAULT_HREF` | STAC resource to load on startup | None (shows intro) | Example: