fix: site URL falls back to localhost when COURSE_HOST is unset
CI / Tool tests and sync-check (push) Successful in 13s
CI / Verify references (all modules, Rust and TS) (push) Successful in 1m52s
CI / Coupling audit on references (push) Successful in 12s
CI / Site build (push) Successful in 23s
CI / Naive engine tests (Module 0) (push) Successful in 31s

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Lucas Winther
2026-10-29 18:42:18 +01:00
co-authored by Claude Opus 5.5
parent ce1baaa706
commit 1c2fb2eb07
2 changed files with 11 additions and 5 deletions
+7
View File
@@ -0,0 +1,7 @@
# Course website
Astro Starlight site built from the lessons in `course/`.
Run locally: `npm ci && npm run dev` (from this directory), then open http://localhost:4321.
`COURSE_HOST` (e.g. `course.example.com`) sets the public site URL at build time. Unset, the site uses `http://localhost:4321`. Deploys must set it; see `../deploy/README.md`.
+4 -5
View File
@@ -1,14 +1,13 @@
import { defineConfig } from "astro/config";
import starlight from "@astrojs/starlight";
// The site is served at the root of its own subdomain. COURSE_HOST is required at build
// time (e.g. COURSE_HOST=course.example.com); there is deliberately no default, so a
// deploy can never ship with a placeholder URL.
// The site is served at the root of its own subdomain. Set COURSE_HOST at build time
// (e.g. COURSE_HOST=course.example.com). Unset means a local run (http://localhost:4321);
// deploys must not rely on this: deploy/Dockerfile and docker-compose.yml require COURSE_HOST.
const host = process.env.COURSE_HOST;
if (!host) throw new Error("COURSE_HOST is not set (e.g. COURSE_HOST=course.example.com)");
export default defineConfig({
site: `https://${host}`,
site: host ? `https://${host}` : "http://localhost:4321",
base: "/",
integrations: [
starlight({