fix(gateway): load dotenv before federation tier gate (#1138)

This commit is contained in:
shaggy (mosaic-dev box)
2026-08-09 20:50:37 -05:00
parent b4753a75cd
commit b82a51da80
4 changed files with 114 additions and 15 deletions
+14
View File
@@ -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();