[Dotenv] Add SYMFONY_DOTENV_PATH, consumed by debug:dotenv for custom .env path#52638
Merged
nicolas-grekas merged 1 commit intosymfony:7.1from Jan 2, 2024
Merged
[Dotenv] Add SYMFONY_DOTENV_PATH, consumed by debug:dotenv for custom .env path#52638nicolas-grekas merged 1 commit intosymfony:7.1from
SYMFONY_DOTENV_PATH, consumed by debug:dotenv for custom .env path#52638nicolas-grekas merged 1 commit intosymfony:7.1from
Conversation
dotenv_pathdotenv_path
2433512 to
54b8d8d
Compare
GromNaN
commented
Nov 17, 2023
GromNaN
commented
Nov 17, 2023
| return substr($filePath, \strlen($this->projectDirectory) + 1); | ||
| } | ||
|
|
||
| return basename($filePath); |
Member
Author
There was a problem hiding this comment.
Only display the basename if the dotenv file is outside of the project directory.
nicolas-grekas
approved these changes
Nov 20, 2023
Member
nicolas-grekas
left a comment
There was a problem hiding this comment.
The SYMFONY_DOTENV_PATH env var is a nice feature in itself, let's tell about in in the changelog and in the title of the PR
Member
Author
Do you want the Dotenv class to read |
Member
|
Nope, I want the env var you're proposing to be documented in the changelog |
dotenv_pathSYMFONY_DOTENV_PATH, consumed by the debug:dotenv for custom .env path
SYMFONY_DOTENV_PATH, consumed by the debug:dotenv for custom .env pathSYMFONY_DOTENV_PATH, consumed by debug:dotenv for custom .env path
165f8b7 to
3dddbf9
Compare
Introduce SYMFONY_DOTENV_PATH set by DotEnv class and read by debug:dotenv command to contextualize the debug info with the file that was actually parsed.
3dddbf9 to
52b6416
Compare
Member
|
Thank you @GromNaN. |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Continuation of #47901
Introduce
SYMFONY_DOTENV_PATHset by DotEnv class and read by thedebug:dotenvcommand to contextualize the debug info with the file that was actually parsed.The custom path can be set in many ways:
(new Dotenv())->bootEnv(dirname(__DIR__).'my/custom/path/to/.env');composer.json:"extra": { "runtime": { "dotenv_path": "my/custom/path/to/.env" }$_SERVER['APP_RUNTIME_OPTIONS'] = ['dotenv_path' => 'my/custom/path/to/.env'];The dotenv file can be outside of the
project_dir.