-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[Dotenv] Add SYMFONY_DOTENV_PATH, consumed by debug:dotenv for custom .env path
#52638
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
dotenv_pathdotenv_path
2433512 to
54b8d8d
Compare
| return substr($filePath, \strlen($this->projectDirectory) + 1); | ||
| } | ||
|
|
||
| return basename($filePath); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only display the basename if the dotenv file is outside of the project directory.
nicolas-grekas
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
Do you want the Dotenv class to read |
|
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
|
Thank you @GromNaN. |
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.