mikavehns / BookGPT

Writes complete books with given paramters, using GPT-3.
MIT License
353 stars 66 forks source link

Move keys to .env #14

Closed matthewdeanmartin closed 1 year ago

matthewdeanmartin commented 1 year ago

Right now the openai key is put in a json doc. A more failsafe pattern is to store it in a .env file, .gitignore it, and use the dotenv package or pipenv to load the value & then check os.environ["KEY"] for the key. This is an extremely common pattern and there are many tutorials and tools specifically for this scenario.

When you accidentally check in your key, (or people who fork this do) you'll have to delete your key and regenerate new ones because git still shows keys in history.

mikavehns commented 1 year ago

Thank you so much for your suggestion. This is my first public GitHub repository and I'm still learning the ropes. I will make the necessary changes tomorrow. Thank you again for your help