MCPcopy Create free account
hub / github.com/bearlyai/OpenADE / parseRuntimeNodeServeConfig

Function parseRuntimeNodeServeConfig

projects/runtime-node/src/cli.ts:124–142  ·  view source on GitHub ↗
(args: string[] = process.argv.slice(2), env: NodeJS.ProcessEnv = process.env)

Source from the content-addressed store, hash-verified

122}
123
124export function parseRuntimeNodeServeConfig(args: string[] = process.argv.slice(2), env: NodeJS.ProcessEnv = process.env): RuntimeNodeServeConfig {
125 const command = args[0] === "serve" ? args.slice(1) : args
126 const configPath = flagValue(command, "--config") ?? env.RUNTIME_NODE_CONFIG
127 const fileConfig = readConfigFile(configPath)
128 const codexAppServer = codexAppServerFromEnvOrFlags(command, env)
129
130 return {
131 ...fileConfig,
132 host: flagValue(command, "--host") ?? env.RUNTIME_NODE_HOST ?? fileConfig.host,
133 port: numberValue(flagValue(command, "--port") ?? env.RUNTIME_NODE_PORT) ?? fileConfig.port,
134 path: flagValue(command, "--path") ?? env.RUNTIME_NODE_PATH ?? fileConfig.path,
135 token: flagValue(command, "--token") ?? env.RUNTIME_NODE_TOKEN ?? fileConfig.token,
136 checkpointFile: flagValue(command, "--checkpoint-file") ?? env.RUNTIME_NODE_CHECKPOINT_FILE ?? fileConfig.checkpointFile,
137 allowUnauthenticatedLoopback:
138 booleanValue(flagValue(command, "--allow-unauthenticated-loopback") ?? env.RUNTIME_NODE_ALLOW_UNAUTHENTICATED_LOOPBACK) ??
139 fileConfig.allowUnauthenticatedLoopback,
140 codexAppServers: codexAppServer ? [...(fileConfig.codexAppServers ?? []), codexAppServer] : fileConfig.codexAppServers,
141 }
142}
143
144export async function startRuntimeNodeServe(config: RuntimeNodeServeConfig): Promise<RuntimeNodeHttpServer> {
145 const agentExecutor = createRuntimeNodeHarnessAgentExecutor()

Callers 1

startRuntimeNodeCliFunction · 0.85

Calls 5

flagValueFunction · 0.85
numberValueFunction · 0.85
booleanValueFunction · 0.85
readConfigFileFunction · 0.70

Tested by

no test coverage detected