ESGTree / Watchtower

0 stars 0 forks source link

Add dotenv package and .env file #7

Closed mohammadalipak closed 1 month ago

mohammadalipak commented 1 month ago

To prevent passwords, database connection urls, and other secrets from being exposed, it is considered bad practice to commit these things in code. However, this means that whenever we pull code from git, we have to manually enter these values in the code to make it work.

The way we solve this problem is by creating a separate file (usually a .env) file which keeps all these environment variables and passwords, and we simply load them into the code using process.env.PASSWORD_NAME.

We should add support for this in our API repo. The npm package to load is called dotenv. You can learn more about how to use it here: https://www.npmjs.com/package/dotenv

Also, please add the .env file to .gitignore so it doesn't get committed

ShamiDev commented 1 month ago

@mohammadalipak I have installed the dotenv package and added the .env file. Commit -> 98db4f3

Let me know if I've missed anything or need to add anything!