e61b92132c
<img width="700" height="771" alt="image" src="https://github.com/user-attachments/assets/b784fbe6-f976-4c9a-84c1-3d90a9010665" /> Second one :)
18 lines
390 B
TypeScript
18 lines
390 B
TypeScript
import * as fs from 'fs-extra';
|
|
import dotenv from 'dotenv';
|
|
import { findPathFile } from './file-find';
|
|
|
|
export const loadEnvVariables = async (appPath: string) => {
|
|
let envFile = '';
|
|
|
|
try {
|
|
const envFilePath = await findPathFile(appPath, '.env');
|
|
|
|
envFile = await fs.readFile(envFilePath, 'utf8');
|
|
} catch {
|
|
// Allow missing .env
|
|
}
|
|
|
|
return dotenv.parse(envFile);
|
|
};
|