Files
Memoh/agent/src/config.ts
T
2026-01-31 18:14:16 +08:00

21 lines
436 B
TypeScript

import { readFileSync } from 'fs'
import { parse } from 'toml'
type AgentGatewayConfig = {
'agent_gateway': {
host?: string
port?: number
},
'server': {
addr?: string
},
'brave': {
api_key?: string
base_url?: string
}
}
export const loadConfig = (path: string = './config.toml'): AgentGatewayConfig => {
const config = parse(readFileSync(path, 'utf-8'))
return config satisfies AgentGatewayConfig
}