Core
install
npm add @dotenv-run/core
usage
import { expand, paths } from "@dotenv-run/core";expand(paths(process.env.NODE_ENV, '../../'));console.log(process.env.API_USERS);
given the following files:
.env API_USERS=$API_BASE/v1/users API_AUTH=$API_BASE/v1/auth.env.dev API_BASE=https://localhost:3000.env.prod API_BASE=https://dotenv-run.app
then:
NODE_ENV=dev node index.jshttps://localhost:3000/v1/users
NODE_ENV=prod node index.jshttps://dotenv-run.app/v1/users
The list of options is the same as the ones supported by @dotenv-run/core
. Please refer to the API section for more details.