Respect DOTENV_CONFIG_PATH for dotenv load path

Matches systemd Environment=DOTENV_CONFIG_PATH=/home/psa/.env so keys are not reported as 0 when only ~/.env exists.

Made-with: Cursor
This commit is contained in:
mineseo-kim 2026-04-09 09:14:57 +09:00
parent 1a4652c185
commit 586f516d4a
1 changed files with 4 additions and 1 deletions

View File

@ -1,6 +1,9 @@
import { config } from 'dotenv';
import { hostname } from 'os';
config();
import { resolve } from 'path';
// Prefer systemd/cron-set DOTENV_CONFIG_PATH; otherwise cwd .env (default dotenv behavior).
config({ path: process.env.DOTENV_CONFIG_PATH || resolve(process.cwd(), '.env') });
const generateInstanceId = () => {
return process.env.INSTANCE_ID || hostname() || `kord-${Math.random().toString(36).substring(2, 7)}`;