File size: 652 Bytes
88c4c60 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | import { getSettings } from "@/lib/localDb";
import { applyOutboundProxyEnv } from "@/lib/network/outboundProxy";
let initialized = false;
export async function ensureOutboundProxyInitialized() {
if (initialized) return true;
try {
const settings = await getSettings();
applyOutboundProxyEnv(settings);
initialized = true;
} catch (error) {
console.error("[ServerInit] Error initializing outbound proxy:", error);
}
return initialized;
}
// Defer init so HTTP server accepts connections first
setImmediate(() => {
ensureOutboundProxyInitialized().catch(console.log);
});
export default ensureOutboundProxyInitialized;
|