Ad
Best Way To Store Secrets In Application
Which one would be a better way to store secret API keys in Node js applications.
Ad
Answer
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.
Ad
source: stackoverflow.com
Related Questions
- → Maximum call stack exceeded when instantiating class inside of a module
- → Browserify api: how to pass advanced option to script
- → Node.js Passing object from server.js to external modules?
- → gulp-rename makes copies, but does not replace
- → requiring RX.js in node.js
- → Remove an ObjectId from an array of objectId
- → Can not connect to Redis
- → React: How to publish page on server using React-starter-kit
- → Express - better pattern for passing data between middleware functions
- → Can't get plotly + node.js to stream data coming through POST requests
- → IsGenerator implementation
- → Async/Await not waiting
- → (Socket.io on nodejs) Updating div with mysql data stops without showing error
Ad