MCPcopy Create free account
hub / github.com/TraderAlice/OpenAlice / writeConfigSection

Function writeConfigSection

src/core/config.ts:1072–1082  ·  view source on GitHub ↗
(section: ConfigSection, data: unknown)

Source from the content-addressed store, hash-verified

1070
1071/** Validate and write a config section to disk. Returns the validated config. */
1072export async function writeConfigSection(section: ConfigSection, data: unknown): Promise<unknown> {
1073 const schema = sectionSchemas[section]
1074 const validated = schema.parse(data)
1075 await mkdir(CONFIG_DIR, { recursive: true })
1076 await writeFile(resolve(CONFIG_DIR, sectionFiles[section]), JSON.stringify(validated, null, 2) + '\n')
1077 if (section === 'marketData') {
1078 const keys = (validated as { providerKeys?: Record<string, string | undefined> }).providerKeys
1079 if (keys) await mirrorProviderKeysToGlobal(keys)
1080 }
1081 return validated
1082}
1083
1084/** Read web sub-channel definitions from disk. Returns empty array if file missing. */
1085export async function readWebSubchannels(): Promise<WebChannel[]> {

Callers 3

config.spec.tsFile · 0.85
createToolsRoutesFunction · 0.85
createConfigRoutesFunction · 0.85

Calls 2

parseMethod · 0.80

Tested by

no test coverage detected