Skip to content

Latest commit

 

History

History
42 lines (31 loc) · 582 Bytes

README.md

File metadata and controls

42 lines (31 loc) · 582 Bytes

Original from: https://github.com/zetachang/react-native-dotenv

babel-plugin-dotenv

Loads environment variables from a .env file through import statement.

Installation

$ npm install babel-plugin-dotenv

Usage

.babelrc

{
  "plugins": [["babel-plugin-dotenv", {
      "replacedModuleName": "babel-dotenv"
   }]]
}

.env

DB_HOST=localhost
DB_USER=root
DB_PASS=s1mpl3

In whatever.js

import { DB_HOST, DB_USER, DB_PASS } from "babel-dotenv"
db.connect({
  host: DB_HOST,
  username: DB_USER,
  password: DB_PASS
});