1.3.5 • Published 1 month ago

@dotenv-run/core v1.3.5

Weekly downloads
-
License
ISC
Repository
-
Last release
1 month ago

@dotenv-run/core

  • ✅ Load environment variables from the command line API_BASE=/v1/ core
  • ✅ Load environment variables from .env files
  • ✅ Expand environment variables API_URL=$API_BASE/users
  • ✅ Define environment variables for a specific environment (e.g. .env.production)
  • ✅ Load priorities of .env.* files (e.g. .env.production > .env)
  • ✅ Hierarchical cascading configuration in monorepo projects (Nx, Turbo, etc.) apps/next-app/.env > apps/.env > .env

Install

npm add @dotenv-run/core

Usage

// index.js
import { env } from "@dotenv-run/core";
env({
  root: "../..",
  verbose: true,
  prefix: "^API_",
  files: [".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.js
https://localhost:3000/v1/users

NODE_ENV=prod node index.js
https://dotenv-run.app/v1/users

License

MIT © Chihab Otmani

1.3.5

1 month ago

1.3.4

4 months ago

1.3.3

4 months ago

1.3.2

4 months ago

1.3.1

4 months ago

1.3.0

4 months ago

1.2.0

7 months ago

1.1.0

9 months ago

1.0.0

10 months ago

1.2.3

6 months ago

1.2.2

6 months ago

1.2.1

6 months ago

0.5.0

10 months ago

0.4.1

11 months ago

0.4.0

11 months ago

0.3.0

11 months ago

0.2.0

11 months ago

0.1.1

11 months ago

0.1.0

11 months ago