Hiding API key When pushing to github

Hey guys… wondering…
How do I go about hiding my API key if pushing to github>
Do I need to create a module and add it to .gitignore ?

Hello there,

It is most common to have this workflow:

  1. Create a sample.env file which might looks something like this:
API_KEY=
  1. Create a .gitignore file with:
.env
  1. Create a .env file, and add your actual secrets:
API_KEY=string_key

Depending on your stack and environment, you will likely need an external library to handle parsing the .env file. For example, the most common for Nodejs is dotenv.

Hope this helps

1 Like

Thanks brother! Sounds very appropriate and around the lines I thought it would be like.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.