Skip to content

Conversation

@alexkart
Copy link
Contributor

Closes #27.

This pull request introduces improvements to the environment keys checker by allowing additional locations for .env files to be specified and scanned, refactoring how environment file paths are handled, and enhancing the display of missing keys. The changes increase flexibility for projects with multiple or non-standard .env file locations and improve the clarity of output.

Support for additional .env file locations:

  • Added a new configuration option additional_env_locations in config/env-keys-checker.php to specify extra directories or files to scan for .env files. This allows the checker to work with .env files outside the project root or in custom locations.
  • Implemented logic in HelperFunctions.php to aggregate .env files from both the default and additional specified locations, supporting both directories and individual files.

Refactoring and improved handling of file paths:

  • Changed references to environment files from just the filename to the full file path (envFilePath) in the data passed between actions, improving reliability when handling files in different locations. [1] [2]
  • Updated the display of missing keys to show the relative path from the project root instead of just the filename, making it clearer which file is affected when multiple .env files are present.

Test improvements:

  • Updated the basic command existence test to ensure the command runs without exceptions, regardless of exit code, increasing robustness.

@what-the-diff
Copy link

what-the-diff bot commented Sep 14, 2025

PR Summary

  • Enhanced Configuration Flexibility: The PR introduces a feature that allows specifying additional locations to scan .env files. This development increases the flexibility for users to place their environment files as required.

  • Improved Filenames: The PR contributes to the readability of the code by renaming envFile to envFilePath. This reflects the actual function of the variable better—it represents the path to the file, not just the filename itself.

  • Better Handling of File Paths: A new method for handling relative paths has been added, aiding in better display of missing keys and the associated paths.

  • Enhanced Environment Key Retrieval: There has been an enhancement to the .env file processing, allowing for the inclusion of .env files from specified additional locations along with the usual .env file. This aids in consolidating configuration details spread across multiple .env files.

  • Added Support for Environment File Directory Scanning: The PR includes an additional method to retrieve unique environment files from specified directories or files, irrespective of their location.

  • Updated Test Mechanism: Changes have been made to the existing test case which now only checks for the existence of the command without depending on the environment's exit codes. This allows for more flexible testing as the test case will function across different environments with variable states.

@alexkart
Copy link
Contributor Author

I’d also add some tests to cover these changes, but I might do that in a separate PR since they need proper setup.

@msamgan
Copy link
Owner

msamgan commented Sep 15, 2025

Thank you for the PR! I’ll review it and get it merged as soon as possible.

@msamgan
Copy link
Owner

msamgan commented Sep 25, 2025

I am sorry for the delay in the merge. Will go through it soon and merge.

@msamgan msamgan merged commit c23fc8f into msamgan:main Oct 26, 2025
1 check passed
@msamgan
Copy link
Owner

msamgan commented Oct 26, 2025

Thank you for your contribution, and my apologies for the delay in the merge.

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.

Push an Update

2 participants