fix: start durable bridge from ConfigMap symlink
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user