feat: add secret settings manager and migration for legacy settings
- Implemented SecretSettingsManager to handle secret settings with encryption. - Added functionality to migrate legacy plaintext settings into encrypted storage. - Introduced methods for setting, getting, and clearing secret settings. - Created tests for verifying the migration and canonicalization of secret settings. - Updated app state to handle service updates via socket communication. - Added interface for push service updates to manage service state changes.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import * as plugins from '../plugins.ts';
|
||||
import { logger } from '../logging.ts';
|
||||
import type { Onebox } from '../classes/onebox.ts';
|
||||
import * as interfaces from '../../ts_interfaces/index.ts';
|
||||
import * as handlers from './handlers/index.ts';
|
||||
import { files as bundledFiles } from '../../ts_bundled/bundle.ts';
|
||||
|
||||
@@ -77,4 +78,28 @@ export class OpsServer {
|
||||
logger.success('OpsServer stopped');
|
||||
}
|
||||
}
|
||||
|
||||
public async pushDashboardEvent(method: string, payload: unknown): Promise<void> {
|
||||
const typedsocket = (this.server as any)?.typedserver?.typedsocket;
|
||||
if (!typedsocket) {
|
||||
return;
|
||||
}
|
||||
|
||||
const connections = await typedsocket.findAllTargetConnectionsByTag('role', 'ops_dashboard');
|
||||
await Promise.allSettled(
|
||||
connections.map((connection: any) => typedsocket.createTypedRequest(method, connection).fire(payload)),
|
||||
);
|
||||
}
|
||||
|
||||
public async broadcastServiceUpdate(
|
||||
serviceName: string,
|
||||
action: interfaces.requests.IReq_PushServiceUpdate['request']['action'],
|
||||
service?: interfaces.data.IService | null,
|
||||
): Promise<void> {
|
||||
await this.pushDashboardEvent('pushServiceUpdate', {
|
||||
action,
|
||||
serviceName,
|
||||
service: service || undefined,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user