@redocly/cli
Version:
[@Redocly](https://redocly.com) CLI is your all-in-one OpenAPI utility. It builds, manages, improves, and quality-checks your OpenAPI descriptions, all of which comes in handy for various phases of the API Lifecycle. Create your own rulesets to make API g
18 lines • 650 B
JavaScript
import * as dotenv from 'dotenv';
import * as path from 'node:path';
import * as fs from 'node:fs';
export function readEnvVariables(executionFilePath) {
if (executionFilePath) {
let currentDir = path.dirname(executionFilePath);
while (currentDir !== path.resolve(currentDir, '..')) {
const envFilePath = path.join(currentDir, '.env');
if (fs.existsSync(envFilePath)) {
dotenv.config({ path: envFilePath });
break;
}
currentDir = path.resolve(currentDir, '..');
}
}
return process.env;
}
//# sourceMappingURL=read-env-variables.js.map