mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-23 00:13:13 +09:00
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:
1 parent
808eda0513
commit
ee9c200ebf
8 files changed
+247
-30
No files matched your search
@@ -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 }));
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user