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:
parent
1a4652c185
commit
586f516d4a
|
|
@ -1,6 +1,9 @@
|
||||||
import { config } from 'dotenv';
|
import { config } from 'dotenv';
|
||||||
import { hostname } from 'os';
|
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 = () => {
|
const generateInstanceId = () => {
|
||||||
return process.env.INSTANCE_ID || hostname() || `kord-${Math.random().toString(36).substring(2, 7)}`;
|
return process.env.INSTANCE_ID || hostname() || `kord-${Math.random().toString(36).substring(2, 7)}`;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue