Skip to content

Commit 5a77beb

Browse files
committed
Configure public dashboard links for site deploy
1 parent 52e393f commit 5a77beb

5 files changed

Lines changed: 37 additions & 11 deletions

File tree

apps/site/.env.example

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# The public site currently does not require environment variables.
2-
#
3-
# Add public, non-secret site settings here when needed. Astro only exposes
4-
# variables prefixed with PUBLIC_ to browser code.
1+
# Public, non-secret site settings. Astro only exposes variables prefixed with
2+
# PUBLIC_ to browser code.
3+
4+
PUBLIC_BINDHUB_DASHBOARD_URL=http://localhost:3000

apps/site/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,19 @@ pnpm --filter apps-site format
2323

2424
Local dev serves the public site and docs at `http://localhost:3002`.
2525

26+
## Environment
27+
28+
The site is static, so it only accepts public build-time variables:
29+
30+
```sh
31+
PUBLIC_BINDHUB_DASHBOARD_URL=http://localhost:3000
32+
```
33+
34+
In staging, set this to the dashboard origin, for example
35+
`https://app-staging.bindhub.com`. The "Open dashboard" and "Sign in" links use
36+
that value. If it is unset, links fall back to same-origin paths for local proxy
37+
setups.
38+
2639
## Content Boundaries
2740

2841
The public site should stay centered on folders, machines, trust, and developer

apps/site/src/components/SiteShell.astro

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ const { title, description, canonicalPath = Astro.url.pathname } = Astro.props
1212
const pageTitle = title === "Bindhub" ? "Bindhub" : `${title} | Bindhub`
1313
const canonicalUrl = new URL(canonicalPath, Astro.url.origin)
1414
const ogImageUrl = new URL("/bindhub-folder-continuity.png", Astro.url.origin)
15+
const dashboardBaseUrl = (import.meta.env.PUBLIC_BINDHUB_DASHBOARD_URL ?? "").replace(/\/$/, "")
16+
const dashboardUrl = dashboardBaseUrl || "/"
17+
const dashboardSignInUrl = dashboardBaseUrl ? `${dashboardBaseUrl}/auth/sign-in` : "/auth/sign-in"
1518
---
1619

1720
<!doctype html>
@@ -54,8 +57,8 @@ const ogImageUrl = new URL("/bindhub-folder-continuity.png", Astro.url.origin)
5457
<a href="/#machines">Machines</a>
5558
<a href="/#storage">Storage</a>
5659
<a href="/docs/">Docs</a>
57-
<a href="/auth/sign-in">Sign in</a>
58-
<a class="button primary sm nav-cta" href="/auth/sign-in">
60+
<a href={dashboardSignInUrl}>Sign in</a>
61+
<a class="button primary sm nav-cta" href={dashboardUrl}>
5962
Open dashboard
6063
</a>
6164
</div>
@@ -72,8 +75,8 @@ const ogImageUrl = new URL("/bindhub-folder-continuity.png", Astro.url.origin)
7275
<div class="footer-links">
7376
<a href="/docs/">Docs</a>
7477
<a href="/docs/security/">Security</a>
75-
<a href="/dashboard">Dashboard</a>
76-
<a href="/auth/sign-in">Sign in</a>
78+
<a href={dashboardUrl}>Dashboard</a>
79+
<a href={dashboardSignInUrl}>Sign in</a>
7780
</div>
7881
</footer>
7982
<script is:inline>

apps/site/src/pages/index.astro

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
---
22
import SiteShell from "../components/SiteShell.astro"
33
import HeroOrbit from "../components/HeroOrbit.astro"
4+
5+
const dashboardBaseUrl = (import.meta.env.PUBLIC_BINDHUB_DASHBOARD_URL ?? "").replace(/\/$/, "")
6+
const dashboardUrl = dashboardBaseUrl || "/"
47
---
58

69
<SiteShell
@@ -18,7 +21,7 @@ import HeroOrbit from "../components/HeroOrbit.astro"
1821
context, machine state, and the bytes to keep moving.
1922
</p>
2023
<div class="hero-actions">
21-
<a class="button primary" href="/auth/sign-in">
24+
<a class="button primary" href={dashboardUrl}>
2225
Open dashboard
2326
<svg viewBox="0 0 24 24" fill="none" aria-hidden="true">
2427
<path
@@ -306,7 +309,7 @@ import HeroOrbit from "../components/HeroOrbit.astro"
306309
</div>
307310

308311
<div class="section-actions" style="justify-content: center">
309-
<a class="button primary" href="/dashboard">View app route</a>
312+
<a class="button primary" href={dashboardUrl}>View app route</a>
310313
<a class="button secondary" href="/docs/getting-started/">Alpha setup</a>
311314
</div>
312315
</div>

docs/web.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,14 @@ BINDHUB_R2_ACCESS_KEY_ID=<optional blob key id>
222222
BINDHUB_R2_SECRET_ACCESS_KEY=<optional blob secret>
223223
```
224224

225-
Site hosted env: none required today.
225+
Site hosted env:
226+
227+
```sh
228+
PUBLIC_BINDHUB_DASHBOARD_URL=https://app-staging.bindhub.com
229+
```
230+
231+
This is public and build-time only. It drives the static site's dashboard/sign-in
232+
links when the landing/docs site and dashboard are separate services.
226233

227234
Before calling the deployment alpha-ready:
228235

0 commit comments

Comments
 (0)