INNER CODE UNIT · TypeScript
positiveEnvInt
K9i-0/ccpocket · packages/bridge/src/index.ts:33
function positiveEnvInt(name: string, fallback: number): number {
const value = Number(process.env[name]);
return Number.isSafeInteger(value) && value > 0 ? value : fallback;
}
export async function startServer() {
const PORT = parseBridgePort();
const HOST = process.env.BRIDGE_HOST ?? "0.0.0.0";
const API_KEY = process.env.BRIDGE_API_KEY;
const MDNS_ENABLED = shouldAdvertiseMdns(
process.platform,
!!process.env.BRIDGE_DISABLE_MDNS,
);
// Unrestricted access requires the exact value "*".
const ALLOWED_DIRS = parseAllowedDirectories(
process.env.BRIDGE_ALLOWED_DIRS,
process.platform,