MCPcopy Create free account
hub / github.com/elastic/eui / loadEnvFile

Function loadEnvFile

scripts/sync-project-fields.js:42–59  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

40
41// Load environment variables from .env file
42function loadEnvFile() {
43 const envPath = path.join(__dirname, '..', '.env');
44 if (fs.existsSync(envPath)) {
45 const envContent = fs.readFileSync(envPath, 'utf8');
46 const lines = envContent.split('\n');
47
48 lines.forEach(line => {
49 const trimmedLine = line.trim();
50 if (trimmedLine && !trimmedLine.startsWith('#')) {
51 const [key, ...valueParts] = trimmedLine.split('=');
52 if (key && valueParts.length > 0) {
53 const value = valueParts.join('=').trim();
54 process.env[key.trim()] = value;
55 }
56 }
57 });
58 }
59}
60
61// Load environment variables
62loadEnvFile();

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…