extroonie.com/scripts/config.mjs
Extroonie 4a6f6b2062
Some checks are pending
Check site / build (push) Waiting to run
feat: initial commit
2026-09-19 08:37:03 -07:00

18 lines
526 B
JavaScript

import { readFileSync } from 'node:fs';
export function siteBaseURL() {
const { baseURL } = Bun.TOML.parse(readFileSync(new URL('../hugo.toml', import.meta.url), 'utf8'));
const url = new URL(process.env.SITE_BASE_URL || baseURL);
if (
!['http:', 'https:'].includes(url.protocol) ||
url.pathname !== '/' ||
url.search ||
url.hash ||
url.username ||
url.password
)
throw new Error(
'SITE_BASE_URL/baseURL must be an HTTP(S) origin without a subpath, query, fragment, or credentials.',
);
return url;
}