All Projects → formatlos → dotenv-load

formatlos / dotenv-load

Licence: other
Load environment variables from .env, .env.local, .env.production, etc. when running a npm or yarn command.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to dotenv-load

Express Mongoose Es6 Rest Api
💥 A boilerplate application for building RESTful APIs Microservice in Node.js using express and mongoose in ES6 with code coverage and JsonWebToken Authentication
Stars: ✭ 2,811 (+10311.11%)
Mutual labels:  dotenv, yarn
twitch-chat-visualizer
A Node.js Project. Would you like to see your chat stream with a custom design? This is for you!
Stars: ✭ 14 (-48.15%)
Mutual labels:  dotenv, yarn
college-management-react
This is a College management web app in MERN stack.
Stars: ✭ 42 (+55.56%)
Mutual labels:  yarn
upgreat
CLI for a painless way to upgrade your package.json dependencies!
Stars: ✭ 47 (+74.07%)
Mutual labels:  yarn
yarn-workspaces-simple-monorepo
Yarn Workspaces basic monorepo management without Lerna for coding examples
Stars: ✭ 31 (+14.81%)
Mutual labels:  yarn
iridium
💎 Growing collection of VS Code extensions with a fancy name
Stars: ✭ 39 (+44.44%)
Mutual labels:  yarn
docker-npm
npm, yarn, node, npx, bower, grunt, gulp, generate-md - build and dev tools.
Stars: ✭ 53 (+96.3%)
Mutual labels:  yarn
vite.org
The Official Website of Vite - https://vite.org
Stars: ✭ 31 (+14.81%)
Mutual labels:  yarn
docker-symfony
Docker Symfony (PHP-FPM - NGINX - MySQL - MailHog - Redis - RabbitMQ)
Stars: ✭ 32 (+18.52%)
Mutual labels:  yarn
nix-npm-buildpackage
Build nix packages that use npm/yarn
Stars: ✭ 48 (+77.78%)
Mutual labels:  yarn
double-bundle
Example for integrating React NPM dependencies with Clojurescript
Stars: ✭ 23 (-14.81%)
Mutual labels:  yarn
molecule
⚛️ –  – ⚛️ Boilerplate for cross platform web/native react apps with electron.
Stars: ✭ 95 (+251.85%)
Mutual labels:  yarn
express-ts-api-boilerplate
Express TypeScript API Boilerplate
Stars: ✭ 15 (-44.44%)
Mutual labels:  dotenv
php-env
A small and fast .env loader for PHP
Stars: ✭ 19 (-29.63%)
Mutual labels:  dotenv
react-simple-boilerplate
Simple React Boilerplate with Webpack, Github Actions, Scss, Lazy Loading etc....
Stars: ✭ 38 (+40.74%)
Mutual labels:  yarn
wp-graphql
WordPress REST API exposed via GraphQL
Stars: ✭ 59 (+118.52%)
Mutual labels:  yarn
generator-react-web
Yeoman generator for creating interactive web sites with React and Redux + Webpack, Flow, ES7+, Babel, Yarn, npm Scripts, i18n, Redux Saga, SCSS, CSS Modules
Stars: ✭ 35 (+29.63%)
Mutual labels:  yarn
nodejs-graphql-template
Template project for Node.js® GraphQL APIs
Stars: ✭ 13 (-51.85%)
Mutual labels:  yarn
react-webpack-starter
A really simple boiler plate for creating react applications bundled by webpack (using ES6+, Babel, SASS and webpack development server) ⚛️
Stars: ✭ 86 (+218.52%)
Mutual labels:  yarn
cv
✏️✏️Java软件工程师简历
Stars: ✭ 47 (+74.07%)
Mutual labels:  yarn

dotenv-load code style: prettier

Load environment variables from .env, .env.local, .env.production, etc. when running a npm or yarn command.

This dotenv loading behaviour was extracted from create-react-app to be also usable with non create-react-app projects like next.js or any other node specific project.

Usage

Use in yarn or npm commands

dotenv-load can be used in an yarn/npm command:

{
  "scripts": {
    "dev": "dotenv-load node server.js",
    "build": "NODE_ENV=production dotenv-load node server.js"
  }
}

Use in node script

dotenv-load can be used in an yarn/npm command:

const dotenvLoad = require('dotenv-load');
dotenvLoad();

ignore .local files

add .local files to .gitignore

.env.local
.env.development.local
.env.production.local

What other .env* files can I use?

dotenv-load will load the following files, starting from the bottom. The first value set (or those already defined in the environment) take precedence:

  • .env - The Original®
  • .env.local - Local overrides. This file is loaded for all environments except test.
  • .env.development, .env.test, .env.production - Environment-specific settings.
  • .env.development.local, .env.test.local, .env.production.local - Local overrides of environment-specific settings.

How can I use custom env file?

You can pass a string to dotenvLoad function, but your file should have a name like .env.YOUR_CUSTOM_NAME, for example: .env.default.

Then you can initialize it as follows:

dotenvLoad() # will initialize standard names
dotenvLoad('default') # will initialize your `.env.default` (while not overwriting defined vars above)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].