Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove keys.py and replace with python-dotenv #39

Merged
merged 3 commits into from
Apr 2, 2023

Conversation

jcp
Copy link
Contributor

@jcp jcp commented Apr 2, 2023

  • Removed keys.py.
  • Added .env.template.
  • Added .env to .gitignore.
  • Updated various files that imported keys to use os.getenv instead.
  • Updated requirements.txt dependencies and move to root directory.
  • Updated README.md with instructions on setting up environment variables.

This change improves security, flexibility, and makes it easier to use Auto-GPT in notebooks. Environment variables are stored in .env and loaded via load_dotenv() in scripts/main.py.

jcp added 3 commits April 2, 2023 05:44
- Removed `keys.py`.
- Added `.env.template`.
- Added `.env` to `.gitignore`.
- Updated various files that imported `keys` to use `os.getenv` instead.
- Updated `requirements.txt` dependencies.
- Updated README.md with instructions on setting up environment variables.

This change improves security, flexibility, and makes it easier to use Auto-GPT in notebooks. Environment variables are stored in `.env` and loaded via `load_dotenv()` in `scripts/main.py`.
@altryne
Copy link

altryne commented Apr 2, 2023

The first thing I wanted to do since opening this repo 5 minutes ago, is this PR.
Kudos to the author, LGTM, please merge

@altryne
Copy link

altryne commented Apr 2, 2023

Added my api in .env, and getting this error:
CleanShot 2023-04-02 at 13 22 22@2x

@altryne
Copy link

altryne commented Apr 2, 2023

All files apparently need load_dotenv for this to work, not only main.py
I was able to fix this when I added

import dotenv
dotenv.load_dotenv()

To both chat.py and speak.py

@jcp
Copy link
Contributor Author

jcp commented Apr 2, 2023

@altryne You're right. Typically that's not required. But given the way the app is structured, load_dotenv() needs to be called in main.py, chat.py and speak.py. I've pushed a fix: 5e746af.

Ideally, with some additional refactoring, this can be avoided.

Copy link
Member

@Torantulino Torantulino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent work, thank you.

@Torantulino Torantulino merged commit c25c175 into Significant-Gravitas:master Apr 2, 2023
@jcp jcp deleted the environment-variables branch April 2, 2023 23:33
Say383 pushed a commit to Say383/Auto-GPT that referenced this pull request Sep 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants