fix(gateway): load dotenv before federation tier gate (#1138)
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
import { config } from 'dotenv';
|
||||
import { existsSync } from 'node:fs';
|
||||
import { homedir } from 'node:os';
|
||||
import { join, resolve } from 'node:path';
|
||||
|
||||
// Load .env from daemon config dir (global install / daemon mode).
|
||||
// It takes precedence over file-based local-dev configuration.
|
||||
const daemonEnv = join(homedir(), '.config', 'mosaic', 'gateway', '.env');
|
||||
if (existsSync(daemonEnv)) config({ path: daemonEnv });
|
||||
|
||||
// Load .env from monorepo root (cwd is apps/gateway when run via pnpm filter),
|
||||
// then fill any remaining values from apps/gateway/.env when present.
|
||||
config({ path: resolve(process.cwd(), '../../.env') });
|
||||
config();
|
||||
Reference in New Issue
Block a user