Skip to content

Commit 1b7d8b3

Browse files
bug #59007 [Dotenv] read runtime config from composer.json in debug dotenv command (xabbuh)
This PR was merged into the 5.4 branch. Discussion ---------- [Dotenv] read runtime config from composer.json in debug dotenv command | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix #58987 | License | MIT same approach as what we already did for the dump command in #45430 Commits ------- 9f4345f read runtime config from composer.json in debug dotenv command
2 parents 5955c9b + 9f4345f commit 1b7d8b3

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/Symfony/Component/Dotenv/Command/DebugCommand.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,17 @@ protected function execute(InputInterface $input, OutputInterface $output): int
5050
return 1;
5151
}
5252

53-
$filePath = $this->projectDirectory.\DIRECTORY_SEPARATOR.'.env';
53+
$dotenvPath = $this->projectDirectory;
54+
55+
if (is_file($composerFile = $this->projectDirectory.'/composer.json')) {
56+
$runtimeConfig = (json_decode(file_get_contents($composerFile), true))['extra']['runtime'] ?? [];
57+
58+
if (isset($runtimeConfig['dotenv_path'])) {
59+
$dotenvPath = $this->projectDirectory.'/'.$runtimeConfig['dotenv_path'];
60+
}
61+
}
62+
63+
$filePath = $dotenvPath.'/.env';
5464
$envFiles = $this->getEnvFiles($filePath);
5565
$availableFiles = array_filter($envFiles, 'is_file');
5666

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy