Hacker News new | ask | show | jobs
by hasangursoy 1628 days ago
Actually already added to .gitignore file but then realized that .js files are not being discarded by .gitignore
2 comments

If this is a Node.js program you should store private variables in a .env file (with .env added to your .gitignore) then call process.env.[variable name here] to get the key at runtime.

Look up documentation and examples on .env files.

If you deploy to a service such as Vercel or AWS you can set environment variables there for production.

They are if the gitignore matches the file, just like any other filetype.