Skip to content

[Bug] Passing --env with a nested path #315

@Chrilleweb

Description

@Chrilleweb

Describe the bug

Passing --env with a nested path (for example config/.env.prod) loses the directory information because path.basename() is used.

As a result, the tool only keeps ".env.prod" and assumes the file is located in the current working directory.

This can cause the wrong file to be used for comparison when the file actually exists in a subdirectory.

Expected behavior

The full path provided via --env should be preserved and used instead of stripping it to only the filename.

Additional context

This occurs in discoverEnvFiles.ts where envFlag is converted using path.basename().

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions