Implement host plugins

Add ability to define plugin code that runs in the context of a host,
starts up with the host does, and stops when the host shuts down.
This commit is contained in:
Hornwitser committed 2023-11-25 19:18:33 +01:00
1 parent 808eda0513
commit ee9c200ebf
8 files changed
+247 -30

No files matched your search

+8 -1
View File
@@ -203,7 +203,7 @@ async function startHost() {
}
let hostConnector = new HostConnector(hostConfig, tlsCa, pluginInfos);
let host = new Host(hostConnector, hostConfig, tlsCa, pluginInfos);
let host = new Host(hostConnector, args.config, hostConfig, tlsCa, pluginInfos);
// Handle interrupts
let secondSigint = false;
@@ -237,6 +237,13 @@ async function startHost() {
host.shutdown();
});
try {
await host.loadPlugins();
} catch (err) {
await host.shutdown();
throw err;
}
hostConnector.once("connect", () => {
logger.add(new lib.LinkTransport({ link: host }));
});