fix: start durable bridge from ConfigMap symlink

This commit is contained in:
Codex
2026-07-11 12:21:27 +02:00
parent b12dd85375
commit 3ba7de2c72
2 changed files with 31 additions and 4 deletions
@@ -1,6 +1,6 @@
import { spawn } from "node:child_process";
import { createHash, createHmac, randomUUID, timingSafeEqual } from "node:crypto";
import { mkdtempSync, readFileSync, rmSync } from "node:fs";
import { mkdtempSync, readFileSync, realpathSync, rmSync } from "node:fs";
import { mkdir, open, readFile, readdir, rename, stat, unlink } from "node:fs/promises";
import { createServer } from "node:http";
import { tmpdir } from "node:os";
@@ -1359,4 +1359,13 @@ function positiveIntegerEnv(name) {
return value;
}
if (process.argv[1] && pathToFileURL(process.argv[1]).href === import.meta.url) startServer();
export function isMainModule(argvPath = process.argv[1], moduleUrl = import.meta.url) {
if (!argvPath) return false;
try {
return pathToFileURL(realpathSync(argvPath)).href === pathToFileURL(realpathSync(new URL(moduleUrl))).href;
} catch {
return pathToFileURL(argvPath).href === moduleUrl;
}
}
if (isMainModule()) startServer();