2f11d69
const DEFAULTS = {
region: 'EU-CENTRAL-1',
minAge: 18,
} as const
function readMeta(name: string): string | null {
const meta = document.querySelector<HTMLMetaElement>(`meta[name="${name}"]`)
return meta?.content?.trim() || null
}
/**
* Deployment region injected via `<meta name="app:region">` in index.html,
* so the value can be swapped server-side without rebuilding the bundle.
*/
export function getRegion(): string {
return readMeta('app:region') ?? DEFAULTS.region
}
/** Minimum registration age injected via `<meta name="app:min-age">` in index.html. */
export function getMinAge(): number {
const raw = readMeta('app:min-age')
const parsed = raw ? Number.parseInt(raw, 10) : NaN
return Number.isInteger(parsed) && parsed > 0 ? parsed : DEFAULTS.minAge
}