Files
indiekit-server/scripts/setup-gitea-url-rewrite.mjs
Sven 0bac69090d
All checks were successful
Deploy Indiekit Server / deploy (push) Successful in 1m15s
fix: rewrite gitea.giersig.eu to internal IP before npm install
npm fetches git deps before node_modules exist, so git URL rewriting
must happen in preinstall. Detects jail env via INDIEKIT_BIND_HOST /
INTERNAL_FETCH_URL — no-ops on local dev.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-31 15:09:14 +02:00

19 lines
747 B
JavaScript

#!/usr/bin/env node
// In the node jail, gitea.giersig.eu is not reachable via HTTPS (hairpin NAT).
// Rewrite git URLs to use the internal Gitea jail address before npm fetches git deps.
// Only runs when INDIEKIT_BIND_HOST or INTERNAL_FETCH_URL are set (i.e. on the jail).
import { execSync } from "node:child_process";
if (process.env.INDIEKIT_BIND_HOST || process.env.INTERNAL_FETCH_URL) {
try {
execSync(
'git config --global url."http://10.100.0.90:3000/".insteadOf "https://gitea.giersig.eu/"',
{ stdio: "inherit" }
);
console.log("[setup] Configured git URL rewrite: gitea.giersig.eu → 10.100.0.90:3000");
} catch (err) {
console.warn("[setup] Could not configure git URL rewrite:", err.message);
}
}