feat: load .env file at startup using Node built-in loadEnvFile
Adds process.loadEnvFile() to CLI entry point so API keys (ZHIPUAI_API_KEY, OPENROUTER_API_KEY, XAI_API_KEY, etc.) can be stored in a project .env file instead of shell environment or systemd service config. Uses Node >= 20.12 built-in — no dotenv dependency needed. Silent no-op if .env doesn't exist. Updates .env.example with placeholders for all provider API keys.
This commit is contained in:
@@ -4,5 +4,14 @@ FLYNN_TELEGRAM_TOKEN=your-bot-token-here
|
||||
# Anthropic API Key
|
||||
ANTHROPIC_API_KEY=your-anthropic-api-key-here
|
||||
|
||||
# Optional: ZhipuAI API Key (for GLM models via /model command)
|
||||
# ZHIPUAI_API_KEY=your-zhipuai-api-key-here
|
||||
|
||||
# Optional: OpenRouter API Key
|
||||
# OPENROUTER_API_KEY=your-openrouter-api-key-here
|
||||
|
||||
# Optional: xAI API Key (for Grok models)
|
||||
# XAI_API_KEY=your-xai-api-key-here
|
||||
|
||||
# Optional: Custom config path
|
||||
# FLYNN_CONFIG=/path/to/config.yaml
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
// Load .env file from project root (Node >= 20.12 built-in, no dotenv needed).
|
||||
// Silent no-op if the file doesn't exist.
|
||||
try { process.loadEnvFile(); } catch { /* .env not found — that's fine */ }
|
||||
|
||||
import { Command } from 'commander';
|
||||
import { registerStartCommand } from './start.js';
|
||||
import { registerSendCommand } from './send.js';
|
||||
|
||||
Reference in New Issue
Block a user