- Throw fatal configuration error in src/_data/site.js if SITE_DOMAIN is missing - Require SITE_DOMAIN in docker-compose.yml without default fallback - Require SITE_DOMAIN ARG in Dockerfile with no default fallback
112 lines
3.0 KiB
JavaScript
112 lines
3.0 KiB
JavaScript
import fs from "node:fs";
|
|
import path from "node:path";
|
|
|
|
// Load .env variables into process.env if present
|
|
try {
|
|
const envPath = path.resolve(process.cwd(), ".env");
|
|
if (fs.existsSync(envPath)) {
|
|
const envContent = fs.readFileSync(envPath, "utf-8");
|
|
for (const line of envContent.split("\n")) {
|
|
const trimmed = line.trim();
|
|
if (trimmed && !trimmed.startsWith("#") && trimmed.includes("=")) {
|
|
const [key, ...vals] = trimmed.split("=");
|
|
const value = vals.join("=").trim().replace(/^["']|["']$/g, "");
|
|
if (!process.env[key.trim()]) {
|
|
process.env[key.trim()] = value;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} catch (e) {
|
|
// Silent fallback
|
|
}
|
|
|
|
const siteDomain = process.env.SITE_DOMAIN;
|
|
if (!siteDomain) {
|
|
throw new Error(
|
|
"\n=======================================================================\n" +
|
|
"FATAL CONFIGURATION ERROR: SITE_DOMAIN environment variable is not set.\n" +
|
|
"The site domain must be explicitly defined in your .env file or environment.\n" +
|
|
"Example in .env:\n" +
|
|
" SITE_DOMAIN=riverrooks.dev\n" +
|
|
"=======================================================================\n"
|
|
);
|
|
}
|
|
const siteUrl = process.env.SITE_URL || `https://${siteDomain}`;
|
|
|
|
export default {
|
|
domain: siteDomain,
|
|
url: siteUrl,
|
|
name: "River Rooks",
|
|
title: "River Rooks | Homelab Gateway",
|
|
description: "Engineering Notes, CTF Write-Ups & Systems Architecture",
|
|
status: "SYSTEMS NOMINAL",
|
|
author: "River Rooks",
|
|
systemSpec: "IEEE STD 1003.1",
|
|
nav: [
|
|
{
|
|
label: "Gateway 3",
|
|
url: "/"
|
|
},
|
|
{
|
|
label: "Dispatches",
|
|
url: "/dispatches/"
|
|
},
|
|
{
|
|
label: "Git Forge",
|
|
url: `https://git.${siteDomain}`,
|
|
external: true
|
|
},
|
|
{
|
|
label: "RSS Feed",
|
|
url: "/feed.xml"
|
|
}
|
|
],
|
|
services: [
|
|
{
|
|
name: "Forgejo Git",
|
|
url: `https://git.${siteDomain}`,
|
|
tag: `git.${siteDomain}:2222`,
|
|
desc: "Self-hosted code repositories & dotfiles."
|
|
},
|
|
{
|
|
name: "CyberChef",
|
|
url: `https://chef.${siteDomain}`,
|
|
tag: `chef.${siteDomain}:443`,
|
|
desc: "Hex decoding, cryptography & forensics."
|
|
},
|
|
{
|
|
name: "Stirling PDF",
|
|
url: `https://pdf.${siteDomain}`,
|
|
tag: `pdf.${siteDomain}:443`,
|
|
desc: "Private document OCR and manipulation."
|
|
},
|
|
{
|
|
name: "Uptime Kuma",
|
|
url: `https://status.${siteDomain}`,
|
|
tag: `status.${siteDomain}:443`,
|
|
desc: "High-frequency ping & latency monitors."
|
|
}
|
|
],
|
|
topics: [
|
|
{
|
|
title: "Hardware & Firmware",
|
|
slug: "firmware",
|
|
desc: "SPI dumping, UART interfacing & flash memory extraction",
|
|
badge: "TRACE: HARDWARE"
|
|
},
|
|
{
|
|
title: "Systems Architecture",
|
|
slug: "homelab",
|
|
desc: "Traefik routing, WireGuard mesh & containerized microkernels",
|
|
badge: "SYSTEM: INFRA"
|
|
},
|
|
{
|
|
title: "Offensive Security",
|
|
slug: "security",
|
|
desc: "Kernel exploitation, binary reverse-engineering & CTF writeups",
|
|
badge: "CTF: OFFENSIVE"
|
|
}
|
|
]
|
|
};
|