core: add config update endpoint and functionality

This commit is contained in:
Dax Raad
2025-09-26 02:34:51 -04:00
parent ea21bfd3c6
commit eb7f4e20df
2 changed files with 31 additions and 0 deletions

View File

@@ -686,6 +686,13 @@ export namespace Config {
return state().then((x) => x.config)
}
export async function update(config: Info) {
const filepath = path.join(Instance.directory, "config.json")
const existing = await loadFile(filepath)
await Bun.write(filepath, JSON.stringify(mergeDeep(existing, config), null, 2))
await Instance.dispose()
}
export async function directories() {
return state().then((x) => x.directories)
}