2.2 dotenv install & config “.env” with PSQL connect data

wb todoMVC Master >> 2.2 dotenv install & config with ps…

Steps

Open terminal & navigate to your project’s root directory

$ cd ~/Sites/swag/todo-api

Install the npm package dotenv

$ npm install dotenv --save

Create a .env file in your root project if it does not already exist. This is a dev only setup, so if we accidentally start the server in production mode we want it to fail.

$ cat > .env
db_test_host=127.0.0.1
db_test_port=5432
db_test_name=todo_test
db_test_user=todo_system
db_test_password=todo_system_password
db_dev_host=127.0.0.1
db_dev_port=5432
db_dev_name=todo_dev
db_dev_user=todo_system
db_dev_password=todo_system_password
db_prod_host=127.0.0.1
db_prod_port=5432
db_prod_name=none_prod
db_prod_user=todo_system
db_prod_password=todo_system_password_prod

Now close the file

ctrl + d

Tutorial Navigation

The master tutorial doc is located here: WB todoMVC MASTER

Previous Step: 2.1 create PSQL app user & empty database

Next Step: 2.3 install knex / knex-migrate

A single golf clap? Or a long standing ovation?

By clapping more or less, you can signal to us which stories really stand out.