overmind-mcp
Version:
Orchestrateur universel agents IA multi-modeles via MCP. Inclut le protocole 'Custom-Nickname' pour identifier vos agents avec des surnoms originaux (The Chaos Prophet, Shadow Sniper, etc.), l'isolation mémoire (Private Memory Context) et le support pour
31 lines • 1.29 kB
JavaScript
import fs from 'fs';
export function loadEnvQuietly(envPath) {
try {
if (fs.existsSync(envPath)) {
const content = fs.readFileSync(envPath, 'utf8');
content.split('\n').forEach((line) => {
const match = line.match(/^\s*([\w.-]+)\s*=\s*(.*)?$/);
if (match) {
const key = match[1];
let value = match[2] || '';
// Strip inline comments ONLY after whitespace+#, not # inside values
// This preserves # in API keys, URLs with fragments, etc.
value = value.replace(/\s+#.*$/, '').trim();
if (value.startsWith('"') && value.endsWith('"'))
value = value.slice(1, -1);
else if (value.startsWith("'") && value.endsWith("'"))
value = value.slice(1, -1);
if (!process.env[key])
process.env[key] = value;
}
});
}
}
catch (e) {
// Log malformed .env instead of silently swallowing
if (e instanceof Error) {
console.error(`[loadEnv] Warning: Failed to load ${envPath}: ${e.message}`);
}
}
}
//# sourceMappingURL=loadEnv.js.map