mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 16:54:59 +00:00
aider: Added functionality to load .env
file from git_root
if available.
# Context: USER: load_dotenv from the git_root if avail ASSISTANT: To load the `.env` file from the `git_root` if available, you can modify the `load_dotenv()` function call in `aider/main.py`. Here's the change: ```python aider/main.py <<<<<<< ORIGINAL load_dotenv() ======= if git_root: load_dotenv(os.path.join(git_root, ".env")) else: load_dotenv() >>>>>>> UPDATED ``` This change checks if `git_root` is available and loads the `.env` file from the `git_root` directory. If `git_root` is not available, it falls back to the default behavior of loading the `.env` file from the current working directory.
This commit is contained in:
parent
a1ff34d084
commit
e02b612126
1 changed files with 6 additions and 2 deletions
|
@ -19,13 +19,17 @@ def main(args=None, input=None, output=None):
|
|||
if args is None:
|
||||
args = sys.argv[1:]
|
||||
|
||||
git_root = get_git_root()
|
||||
|
||||
if git_root:
|
||||
load_dotenv(os.path.join(git_root, ".env"))
|
||||
else:
|
||||
load_dotenv()
|
||||
env_prefix = "AIDER_"
|
||||
|
||||
default_config_files = [
|
||||
os.path.expanduser("~/.aider.conf.yml"),
|
||||
]
|
||||
git_root = get_git_root()
|
||||
if git_root:
|
||||
default_config_files.insert(0, os.path.join(git_root, ".aider.conf.yml"))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue