mirror of
https://github.com/BetterCorp/BetterFrame.git
synced 2026-05-27 20:46:33 +00:00
BSB plugins should be actual services (own port, lifecycle, resource ownership). Moved secrets, auth, pairing, bundle, nodered-bridge, and cec-relay from plugin folders to shared modules under server/src/shared/. 4 BSB plugins remain: service-store, service-admin-http, service-api-http, service-coordinator-ws. service-admin-http now initializes secrets + auth as plain modules in init() using the store repo from the plugin-registry singleton. No more setSiblings() hack or inter-plugin wiring. sec-config.yaml updated: secrets/auth config moved into service-admin-http, pairing config into service-api-http, nodered config into service-coordinator-ws.
19 lines
600 B
TypeScript
19 lines
600 B
TypeScript
/**
|
|
* Module-level store registry — the one cross-plugin reference needed.
|
|
*
|
|
* service-store registers its repo in init(). Downstream plugins
|
|
* (admin-http, api-http, coordinator-ws) look it up in their init().
|
|
* initAfterPlugins guarantees ordering.
|
|
*/
|
|
import type { Repository } from "../plugins/service-store/repository.js";
|
|
|
|
let _repo: Repository | undefined;
|
|
|
|
export function registerRepo(repo: Repository): void {
|
|
_repo = repo;
|
|
}
|
|
|
|
export function getRepo(): Repository {
|
|
if (!_repo) throw new Error("plugin-registry: store repo not registered (init order bug?)");
|
|
return _repo;
|
|
}
|