Skip to content

Search for .env in current directory#73

Merged
kevinbackhouse merged 1 commit into
GitHubSecurityLab:mainfrom
kevinbackhouse:find_dotenv
Nov 14, 2025
Merged

Search for .env in current directory#73
kevinbackhouse merged 1 commit into
GitHubSecurityLab:mainfrom
kevinbackhouse:find_dotenv

Conversation

@kevinbackhouse
Copy link
Copy Markdown
Collaborator

Apparently load_dotenv() uses the location of the script by default, not the cwd.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes the .env file loading behavior to search in the current working directory instead of the script's location. The change addresses a common issue where load_dotenv() defaults to the script's directory rather than the current working directory.

Key Changes:

  • Added find_dotenv import from dotenv module
  • Modified load_dotenv() to use find_dotenv(usecwd=True) for cwd-based search

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@m-y-mo
Copy link
Copy Markdown
Contributor

m-y-mo commented Nov 14, 2025

There's one here too: https://github.com/GitHubSecurityLab/seclab-taskflow-agent/blob/main/src/seclab_taskflow_agent/agent.py#L21

@kevinbackhouse kevinbackhouse merged commit f1c14af into GitHubSecurityLab:main Nov 14, 2025
9 checks passed
@kevinbackhouse kevinbackhouse deleted the find_dotenv branch November 14, 2025 11:53
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.

3 participants