feat(config): persist config.patch updates atomically
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user