feat(runtime): add production control-plane foundation
This commit is contained in:
@@ -1,24 +1,7 @@
|
||||
import { resolve } from 'node:path';
|
||||
import { createCanaryGateway } from './canary-gateway.ts';
|
||||
import { readCanaryRuntimeOptions } from './canary-runtime.ts';
|
||||
|
||||
import {
|
||||
CANARY_DEFAULT_PORT,
|
||||
CANARY_DEFAULT_UPSTREAM_PORT,
|
||||
createCanaryGateway,
|
||||
} from './canary-gateway.ts';
|
||||
|
||||
function environmentPort(name: string, fallback: number): number {
|
||||
const value = process.env[name];
|
||||
if (value === undefined || value === '') return fallback;
|
||||
const port = Number(value);
|
||||
if (!Number.isInteger(port)) throw new Error(`${name} must be an integer port`);
|
||||
return port;
|
||||
}
|
||||
|
||||
const gateway = createCanaryGateway({
|
||||
distDir: resolve(process.env.CANARY_DIST_DIR ?? 'apps/web/dist'),
|
||||
port: environmentPort('CANARY_PORT', CANARY_DEFAULT_PORT),
|
||||
upstreamPort: environmentPort('CANARY_UPSTREAM_PORT', CANARY_DEFAULT_UPSTREAM_PORT),
|
||||
});
|
||||
const gateway = createCanaryGateway(readCanaryRuntimeOptions(process.env));
|
||||
|
||||
let stopping = false;
|
||||
async function stop(signal: string): Promise<void> {
|
||||
|
||||
Reference in New Issue
Block a user