mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-24 14:25:00 +00:00
Load environment variables from a .env
file using python-dotenv
package.
# Context: USER: load dotenv ASSISTANT: To load environment variables from a `.env` file using the `python-dotenv` package, you can add the following lines at the beginning of the `main()` function in the `coder.py` file: ```python import os from dotenv import load_dotenv load_dotenv() ``` You will also need to install the `python-dotenv` package if you haven't already. You can install it using pip: ``` pip install python-dotenv ``` Here's the change to the `coder.py` file: ```python coder.py <<<<<<< ORIGINAL def main(): env_prefix = "CODER_" ======= import os from dotenv import load_dotenv def main(): load_dotenv() env_prefix = "CODER_" >>>>>>> UPDATED ```
This commit is contained in:
parent
50ba2136b7
commit
bd88c4c40f
1 changed files with 6 additions and 3 deletions
7
coder.py
7
coder.py
|
@ -566,9 +566,12 @@ class Coder:
|
||||||
return commit_hash, commit_message
|
return commit_hash, commit_message
|
||||||
|
|
||||||
|
|
||||||
def main():
|
import os
|
||||||
env_prefix = "CODER_"
|
from dotenv import load_dotenv
|
||||||
|
|
||||||
|
def main():
|
||||||
|
load_dotenv()
|
||||||
|
env_prefix = "CODER_"
|
||||||
parser = argparse.ArgumentParser(description="Chat with GPT about code")
|
parser = argparse.ArgumentParser(description="Chat with GPT about code")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"files", metavar="FILE", nargs="+", help="a list of source code files",
|
"files", metavar="FILE", nargs="+", help="a list of source code files",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue