Skip to main content
Glama
nrwl

Nx MCP Server

Official
by nrwl
loadRootEnvFiles.ts819 B
import { config as loadDotEnvFile } from 'dotenv'; import { expand } from 'dotenv-expand'; import { join } from 'path'; /** * This loads dotenv files from: * - .env * - .local.env * - .env.local */ export function loadRootEnvFiles( workspacePath: string, targetEnv: NodeJS.ProcessEnv = process.env, ): NodeJS.ProcessEnv { let expandedEnv: NodeJS.ProcessEnv = { ...targetEnv, }; for (const file of ['.local.env', '.env.local', '.env']) { const myEnv = loadDotEnvFile({ path: join(workspacePath, file), processEnv: targetEnv, override: true, }); const expanded = expand({ ...myEnv, processEnv: expandedEnv, }); if (expanded.parsed) { expandedEnv = { ...expandedEnv, ...expanded.parsed, }; } } return expandedEnv; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/nrwl/nx-console'

If you have feedback or need assistance with the MCP directory API, please join our Discord server