Manu
Manu

Reputation: 791

Best way to store secrets in application

Which one would be a better way to store secret API keys in Node js applications.

Upvotes: 0

Views: 347

Answers (1)

Navdeep Singh
Navdeep Singh

Reputation: 181

Create .env file at root folder and add your all keys, password in that file. To make it secure never ever add file in git repo. Instead add this file in .gitignore file so that git ignore this file when you push your changes.

Syntax of .env file

APP_URL=http://localhost:3000
APP_KEY=SECRETKEY

Additionally to access the keys from your .env file is process.env.APP_KEY

Its secure method, no one can access this file. I use this way. Hope it gives your answer.

Upvotes: 1

Related Questions