Loads .env and resolves runtime config for OMA app.
// Source: https://github.com/open-multi-agent/open-multi-agent | License: MIT | Copyright Shenzhen YuanASI Technology Co., Ltd. and open-multi-agent contributors
// Provided via justclaw.it.com; keep this notice with the code.
import { existsSync, readFileSync } from 'node:fs'
export interface RuntimeConfig {
readonly runtime: 'cloud' | 'ollama'
readonly model: string
readonly baseURL?: string
readonly apiKey: string
}
export function loadEnv(path = '.env'): void {
if (!existsSync(path)) return
for (const raw of readFileSync(path, 'utf8').split('\n')) {
const line = raw.trim()
if (!line || line.startsWith('#')) continue
const eq = line.indexOf('=')
if (eq === -1) continue
const key = line.slice(0, eq).trim()
const value = line.slice(eq + 1).trim().rep
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key