9router / src /lib /network /initOutboundProxy.js
2api
feat: configurable stream stall timeout + per-provider UI
88c4c60
Raw
History Blame Contribute Delete
652 Bytes
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;