Files
9router/src/lib/network/initOutboundProxy.js
decolua bee8dad946 feat(db): migrate from lowdb to SQLite with repos pattern
- Add modular DB layer (adapters, migrations, repos, helpers)
- Replace localDb/usageDb/requestDetailsDb monoliths with repos
- Add Tailscale tunnel integration & status check API
- Add /api/cli-tools/all-statuses aggregated endpoint
- Add settingsStore (Zustand) and mitm/dbReader
- Add DB unit tests (benchmark, concurrent, migration, vs-lowdb)
2026-05-09 17:48:20 +07:00

26 lines
652 B
JavaScript

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;