import { type ServiceType as ServiceTypeValue } from "../core/config-enums.js"; /** * Nginx Config Generator v2 * * Routes ingress traffic through ForgeProxy. * ForgeProxy handles route matching + policy enforcement. * * /api/users/* -> ForgeProxy -> users service * /api/billing/* -> ForgeProxy -> billing service * /auth/* -> ForgeProxy -> auth service * * nginx forwards requests to ForgeProxy and preserves request metadata. * * Service prefix ordering still matters for nginx location block matching. */ interface Upstream { host: string; port: number; } interface NginxService { prefix: string | null; port?: number; upstreams?: Upstream[]; type?: ServiceTypeValue; } interface SslConfig { cert: string; key: string; } interface RateLimits { requestsPerSecond?: number; authPerSecond?: number; burst?: number; authBurst?: number; maxConnsPerIP?: number; } interface PluginLocation { path: string; config: string; } interface WebSocketRoute { path: string; service: string; } interface ForgeProxyConfig { enabled?: boolean; host?: string; port?: number; keepalive?: number; } interface NginxConfigOptions { domain?: string; services?: Record; ssl?: SslConfig; rateLimits?: RateLimits; staticDir?: string; websockets?: boolean; websocketPaths?: string[]; websocketRoutes?: WebSocketRoute[]; maxBodySize?: number; forgeProxy?: boolean | ForgeProxyConfig | null; trustedProxies?: string[]; pluginLocations?: PluginLocation[]; } interface ManifestNode { host: string; services: string[]; role?: string; } interface DeployManifest { nodes: Record; } interface WebSocketConfig { enabled?: boolean; paths?: string[]; } interface ServiceConfig { type?: ServiceTypeValue; port?: number; prefix?: string | null; websocket?: boolean | string[] | WebSocketConfig; } interface LegacyWebSocketOptions { websockets?: boolean; websocketPaths?: string[]; } interface StaticMount { dir: string; basePath?: string; spaFallback?: boolean; cachePolicy?: "immutable" | "none" | "short"; siteId?: string; domains?: string[]; } interface AppConfig { domains?: string[]; domain?: string; ssl?: SslConfig | null; static?: string | null; staticMounts?: StaticMount[]; services?: string[]; frontend?: { basePath?: string; outDir?: string; spaFallback?: boolean; } | null; } interface HostMetaEntry { domain?: string; services: string[]; } interface PlatformNginxOptions { apps?: Record; services?: Record; hostMeta?: Record; defaultSsl?: SslConfig | null; maxBodySize?: number; forgeProxy?: boolean | ForgeProxyConfig | null; } interface HostNginxOptions { hostMeta: Record; services: Record; ssl?: SslConfig; maxBodySize?: number; forgeProxy?: boolean | ForgeProxyConfig | null; } /** * Generate nginx.conf for a standard (non-platform) deployment. */ export declare function generateNginxConfig(options?: NginxConfigOptions): string; /** * Build the nginx service map from a deployment manifest. * * Scans the manifest and service configs to determine: * - Which services are edge (need nginx routing) * - Their prefixes * - Their upstream addresses (host:port per node) */ export declare function buildNginxServiceMap(manifest: DeployManifest, serviceConfigs: Record, deployPorts?: Record): Record; /** * Build websocket route mappings from per-service websocket config. * * Supports service-level config forms: * websocket: true * websocket: ["/ws", "/ws/chat"] * websocket: { enabled: true, paths: ["/ws"] } */ export declare function buildNginxWebSocketRoutes(serviceConfigs: Record, nginxServices: Record, legacy?: LegacyWebSocketOptions): WebSocketRoute[]; /** * Generate an nginx config for ForgeHost with per-project server blocks. * * Each project gets its own `server { server_name ... }` block. Requests * are forwarded to ForgeProxy, with X-Forge-Project injected per host block. */ export declare function generateHostNginxConfig(options: HostNginxOptions): string; /** * Generate an nginx config for Platform Mode with per-domain TLS, * per-app static dirs, shared auth mount, and X-Forwarded-Host. * * Each app gets its own `server { server_name ... }` block with * individual SSL certificates (defaults to Let's Encrypt paths). */ export declare function generatePlatformNginxConfig(options?: PlatformNginxOptions): string; export {}; //# sourceMappingURL=NginxGenerator.d.ts.map