feat(backup,cli): add AES-256-GCM .gcoord.enc backup, verify, restore CLI and API
This commit is contained in:
parent
413053182b
commit
fbc1eb94e0
7 changed files with 1155 additions and 19 deletions
|
|
@ -133,6 +133,58 @@ export class ConfigManager {
|
|||
}
|
||||
}
|
||||
|
||||
get configDirPath(): string {
|
||||
return this.configDir;
|
||||
}
|
||||
|
||||
async pauseWatcher(): Promise<boolean> {
|
||||
const wasWatching = this.watcher !== null;
|
||||
for (const timer of this.debounceTimers.values()) {
|
||||
clearTimeout(timer);
|
||||
}
|
||||
this.debounceTimers.clear();
|
||||
|
||||
if (this.watcher) {
|
||||
await this.watcher.close();
|
||||
this.watcher = null;
|
||||
}
|
||||
return wasWatching;
|
||||
}
|
||||
|
||||
async resumeWatcher(): Promise<void> {
|
||||
if (!this.watcher) {
|
||||
await this.startWatcher();
|
||||
}
|
||||
}
|
||||
|
||||
reloadAllFromDisk(): void {
|
||||
this.servers.clear();
|
||||
this.systems.clear();
|
||||
this.workflows.clear();
|
||||
this.errors.clear();
|
||||
this.knownFiles.clear();
|
||||
this.snippets = SnippetsFileSchema.parse({});
|
||||
this.alerts = AlertsFileSchema.parse({});
|
||||
this.settings = SettingsSchema.parse({});
|
||||
|
||||
const seeded = seedDefaultConfigs(this.configDir);
|
||||
const seededSet = new Set(seeded);
|
||||
|
||||
const files = this.discoverAllConfigPaths();
|
||||
for (const relPath of files) {
|
||||
this.knownFiles.add(relPath);
|
||||
this.loadFileFromDisk(relPath, seededSet.has(relPath) ? 'seed' : 'disk', false);
|
||||
}
|
||||
|
||||
this.recomputeWarnings();
|
||||
this.emitChange({
|
||||
entityType: 'all',
|
||||
relPath: '*',
|
||||
warnings: structuredClone(this.warnings),
|
||||
errors: [...this.errors.values()].map((e) => structuredClone(e)),
|
||||
});
|
||||
}
|
||||
|
||||
onChange(listener: (event: ConfigChangeEvent) => void): () => void {
|
||||
this.changeListeners.add(listener);
|
||||
return () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue