dotenv
$ npm install dotenv
//--------------------
on file .env
//--------------------
DB_HOST=localhost
DB_USER=root
DB_PASS=s1mpl3
DB_NAME=banco_de_dados
DB_PORT=3306
//--------------------
import the config from .env file
//--------------------
require('dotenv').config()
module.exports = {
username:process.env.DB_USER,
password:process.env.DB_PASS,
database:process.env.DB_NAME,
host:process.env.DB_HOST,
dialect:"mysql"
}
require('dotenv').config()# For python users only
pip install python-dotenv// when yours .env is in other place then default, you can set path to it
const path = require('path')
require('dotenv').config({ path: path.resolve(__dirname, '../../.env') }); //use as many '../' as you need
Also in JavaScript:
- how to hide header in react navigation
- jquery table header agnostic of scroll
- material ui icon button
- set value of input in javascript
- how to make a inventory in js
- tableau js api
- passing a variable to the width style div angular
- how to create a server in node js
- display none in jquery
- how to use a fixed time zone in nodejs
- date object javascript
- url to blob js
- javascript test login password in bootstrap studio
- nodejs include json file
- wait for loop to finish javascript
- christmas
- convert camelcase to sentence case javascript
- jquery remove br from div
- return only specific attributes when making query mongoose
- deploy react js heroku
- react template
- js match any number string
- clear terminal node js
- docker node placement constraints