mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2026-11-18 06:43:13 +09:00
Load datastores with SubscribableDatastore.fromProvider
clusterio#1129 replaced DatastoreProvider.bootstrap with async factories and Instance now takes its FactorioServer in the constructor, so the instance tests pass their server stub there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e84bd97b99
commit
afc1d35668
11 files changed
+69
-87
No files matched your search
+12
-18
@@ -26,26 +26,20 @@ export class ControllerPlugin {
|
||||
const controller = context.controller;
|
||||
const databaseDirectory = controller.config.get("controller.database_directory");
|
||||
|
||||
const groups = new lib.SubscribableDatastore(
|
||||
...await new lib.JsonIdDatastoreProvider(
|
||||
path.join(databaseDirectory, "exp_groups", "groups.json"),
|
||||
messages.GroupRecord.fromJSON.bind(messages.GroupRecord),
|
||||
).bootstrap()
|
||||
);
|
||||
const groups = await lib.SubscribableDatastore.fromProvider(new lib.JsonIdDatastoreProvider(
|
||||
path.join(databaseDirectory, "exp_groups", "groups.json"),
|
||||
messages.GroupRecord.fromJSON.bind(messages.GroupRecord),
|
||||
));
|
||||
|
||||
const roleMappings = new lib.SubscribableDatastore(
|
||||
...await new lib.JsonIdDatastoreProvider(
|
||||
path.join(databaseDirectory, "exp_groups", "role_mappings.json"),
|
||||
messages.RoleMappingRecord.fromJSON.bind(messages.RoleMappingRecord),
|
||||
).bootstrap()
|
||||
);
|
||||
const roleMappings = await lib.SubscribableDatastore.fromProvider(new lib.JsonIdDatastoreProvider(
|
||||
path.join(databaseDirectory, "exp_groups", "role_mappings.json"),
|
||||
messages.RoleMappingRecord.fromJSON.bind(messages.RoleMappingRecord),
|
||||
));
|
||||
|
||||
const manualAssignments = new lib.SubscribableDatastore(
|
||||
...await new lib.JsonIdDatastoreProvider(
|
||||
path.join(databaseDirectory, "exp_groups", "assignments.json"),
|
||||
messages.AssignmentRecord.fromJSON.bind(messages.AssignmentRecord),
|
||||
).bootstrap()
|
||||
);
|
||||
const manualAssignments = await lib.SubscribableDatastore.fromProvider(new lib.JsonIdDatastoreProvider(
|
||||
path.join(databaseDirectory, "exp_groups", "assignments.json"),
|
||||
messages.AssignmentRecord.fromJSON.bind(messages.AssignmentRecord),
|
||||
));
|
||||
|
||||
const plugin = new ControllerPlugin(
|
||||
controller, context.logger, context.plugin.name, groups, roleMappings, manualAssignments,
|
||||
|
||||
Reference in new issue
Block a user