UNPKG

tm-playwright-framework

Version:

Playwright Cucumber TS framework - The easiest way to learn

29 lines (28 loc) 803 B
/** * ENV.TS * * This TypeScript file contains methods to get variables configured based on the given ENV value. * * @author Sasitharan, Govindharam * @reviewer Sahoo, AshokKumar * @version 1.0 - 1st-JUNE-2025 * * @methods * - `getENV`: Fetch the environment data and sets the variable value */ /// <reference path="./../types/env.d.ts" /> import * as dotenv from 'dotenv'; import * as dotenvExpand from 'dotenv-expand'; export const getEnv = () => { if (process.env.ENV) { const env = dotenv.config({ override: true, path: `./app/env/.env.${process.env.ENV}` }); dotenvExpand.expand(env); console.log(`Loaded .env.${process.env.ENV}`); } else { console.error("NO ENV PASSED! Please set process.env.ENV."); } };