// Runtime configuration read once from the served index.html. The Go server // (boardwalk) writes the configured backend.uri into the summer-admin-base // meta; the SPA derives its router base and API base from it (D-02, D-03). export const DEFAULT_BASE = '/backend' const TOKEN = '__SUMMER_ADMIN_BASE__' export function readBase(doc: Document = document): string { const content = doc.querySelector('meta[name="summer-admin-base"]')?.content.trim() ?? '' if (content === '' || content === TOKEN || !content.startsWith('/')) { return DEFAULT_BASE } const trimmed = content.replace(/\/+$/, '') return trimmed === '' ? DEFAULT_BASE : trimmed } const base = readBase() export const runtime = { /** Admin mount path, for example /backend. */ base, /** Admin API root, the mount path plus /api/v1. */ api: `${base}/api/v1`, } as const