mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-22 08:13:12 +09:00
Expose master interfaces to plugin
Expose Express.js app, master config, instance and slave database, slave connections and metrics to the master plugins.
This commit is contained in:
1 parent
cb1d744060
commit
090fbd6dff
2 files changed
+6
-10
No files matched your search
+3
-1
@@ -74,8 +74,10 @@ class BaseInstancePlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class BaseMasterPlugin {
|
class BaseMasterPlugin {
|
||||||
constructor(info) {
|
constructor(info, master, metrics) {
|
||||||
this.info = info;
|
this.info = info;
|
||||||
|
this.master = master;
|
||||||
|
this.metrics = metrics;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -675,7 +675,9 @@ async function loadPlugins(pluginInfos) {
|
|||||||
({ MasterPlugin } = require(`./plugins/${pluginInfo.name}/${pluginInfo.masterEntrypoint}`));
|
({ MasterPlugin } = require(`./plugins/${pluginInfo.name}/${pluginInfo.masterEntrypoint}`));
|
||||||
}
|
}
|
||||||
|
|
||||||
let masterPlugin = new MasterPlugin(pluginInfo);
|
let masterPlugin = new MasterPlugin(
|
||||||
|
pluginInfo, { app, config: masterConfig, db, slaveConnections }, { endpointHitCounter }
|
||||||
|
);
|
||||||
await masterPlugin.init();
|
await masterPlugin.init();
|
||||||
plugins.set(pluginInfo.name, masterPlugin);
|
plugins.set(pluginInfo.name, masterPlugin);
|
||||||
|
|
||||||
@@ -684,14 +686,6 @@ async function loadPlugins(pluginInfos) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
console.log(`Clusterio | Loaded plugin ${pluginInfo.name} in ${Date.now() - pluginLoadStarted}ms`);
|
console.log(`Clusterio | Loaded plugin ${pluginInfo.name} in ${Date.now() - pluginLoadStarted}ms`);
|
||||||
/*
|
|
||||||
main:new masterPlugin({
|
|
||||||
TODO?
|
|
||||||
config, socketio: io, express: app,
|
|
||||||
db,
|
|
||||||
}),
|
|
||||||
pluginConfig,
|
|
||||||
});*/
|
|
||||||
}
|
}
|
||||||
return plugins;
|
return plugins;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user