kokoirc 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/core/config/loader.ts +16 -0
package/package.json
CHANGED
|
@@ -80,6 +80,22 @@ export async function loadConfig(configPath: string): Promise<AppConfig> {
|
|
|
80
80
|
const text = await file.text()
|
|
81
81
|
const parsed = parseTOML(text)
|
|
82
82
|
const config = mergeWithDefaults(parsed)
|
|
83
|
+
|
|
84
|
+
// Load ~/.kokoirc/.env into process.env (Bun only auto-loads cwd/.env)
|
|
85
|
+
const envFile = Bun.file(ENV_PATH)
|
|
86
|
+
if (await envFile.exists()) {
|
|
87
|
+
const envText = await envFile.text()
|
|
88
|
+
for (const line of envText.split("\n")) {
|
|
89
|
+
const trimmed = line.trim()
|
|
90
|
+
if (!trimmed || trimmed.startsWith("#")) continue
|
|
91
|
+
const eqIdx = trimmed.indexOf("=")
|
|
92
|
+
if (eqIdx === -1) continue
|
|
93
|
+
const key = trimmed.slice(0, eqIdx).trim()
|
|
94
|
+
const value = trimmed.slice(eqIdx + 1).trim()
|
|
95
|
+
if (key) process.env[key] = value
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
83
99
|
config.servers = loadCredentials(config.servers, process.env)
|
|
84
100
|
return config
|
|
85
101
|
}
|