In my code, I have API keys and other secrets directly for others to see. I want to prevent that and put them in environment parameter (or hide them otherwise, if you have an idea)
How do I do that? I didn't really understand the answers when I googled it (maybe I looked in the wrong places?)
I would really appreciate the help!
If you are using Javascript
require('dotenv').config();
or
import 'dotenv/config';
Inside this .env file they have to be in the format: KEY=value
...
SECRET=123456abcdef
...
...
const token = sign({email: user.email},
process.env.SECRET,
{subject: user.id, expiresIn: 86400}
);
...
//.gitignore
.env