feat(config): persist config.patch updates atomically

This commit is contained in:
William Valentin
2026-02-15 22:03:21 -08:00
parent c314e0f067
commit 0220ec10dd
13 changed files with 205 additions and 11 deletions
+6 -1
View File
@@ -59,6 +59,8 @@ export interface GatewayServerConfig {
authHttp?: boolean;
uiDir?: string;
config?: Config;
/** Optional persistence callback for config.patch updates. */
persistConfig?: (nextConfig: Config) => Promise<void> | void;
/** Optional callback for system.restart. Should trigger graceful shutdown + process restart. */
restart?: () => Promise<void>;
channelRegistry?: ChannelRegistry;
@@ -193,7 +195,10 @@ export class GatewayServer {
// Config handlers (only if config object is provided)
if (this.config.config) {
const configHandlers = createConfigHandlers({ config: this.config.config });
const configHandlers = createConfigHandlers({
config: this.config.config,
persistConfig: this.config.persistConfig,
});
for (const [method, handler] of Object.entries(configHandlers)) {
this.router.register(method, handler);
}