mirror of
https://github.com/langgenius/dify.git
synced 2026-06-05 15:40:14 +08:00
c0ee821d45
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
21 lines
711 B
TypeScript
21 lines
711 B
TypeScript
import type { ConfigFile } from '@/config/schema'
|
|
import type { YamlStore } from '@/store/store'
|
|
import { loadConfig } from '@/config/config-loader'
|
|
import { setKey } from '@/config/keys'
|
|
import { emptyConfig } from '@/config/schema'
|
|
import { saveConfig } from '@/store/config-writer'
|
|
|
|
export type RunConfigSetOptions = {
|
|
readonly key: string
|
|
readonly value: string
|
|
readonly store: YamlStore
|
|
}
|
|
|
|
export function runConfigSet(opts: RunConfigSetOptions): string {
|
|
const loaded = loadConfig(opts.store)
|
|
const config: ConfigFile = loaded.found ? loaded.config : emptyConfig()
|
|
const next = setKey(config, opts.key, opts.value)
|
|
saveConfig(opts.store, next)
|
|
return `set ${opts.key} = ${opts.value}\n`
|
|
}
|