feat: complete TASK-WP0-07 supervisor
This commit is contained in:
@@ -2,6 +2,12 @@ import { resolve } from "node:path";
|
||||
|
||||
import { createApp } from "./app.js";
|
||||
import { readBrowserSupportRelease } from "./browser-support.js";
|
||||
import { attachApiSupervisorControl, initializeApiCredentialClients, receiveApiCredentials } from "./supervisor-channel.js";
|
||||
|
||||
const credentialChannelEnabled = process.argv.includes("--dada-credential-stdin");
|
||||
if (credentialChannelEnabled) {
|
||||
initializeApiCredentialClients(await receiveApiCredentials());
|
||||
}
|
||||
|
||||
const browserSupportRelease = readBrowserSupportRelease(resolve("RELEASE.json"));
|
||||
const app = await createApp(browserSupportRelease ? { browserSupportRelease } : {});
|
||||
@@ -10,3 +16,10 @@ await app.listen({
|
||||
host: "127.0.0.1",
|
||||
port: 43121,
|
||||
});
|
||||
|
||||
const controlPipeIndex = process.argv.indexOf("--dada-control-pipe");
|
||||
if (controlPipeIndex >= 0) {
|
||||
const controlPipe = process.argv[controlPipeIndex + 1];
|
||||
if (!controlPipe) throw new Error("Supervisor control pipe name is required.");
|
||||
attachApiSupervisorControl(controlPipe, () => app.close());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user