Skip to content

Commit

Permalink
Merge branch '6.4' into 7.1
Browse files Browse the repository at this point in the history
* 6.4:
  [HttpClient] Close gracefull when the server closes the connection abruptly
  read runtime config from composer.json in debug dotenv command
  • Loading branch information
nicolas-grekas committed Nov 27, 2024
2 parents 56a10f3 + 1ac5e7e commit 245d1af
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion Command/DebugCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,19 @@ protected function execute(InputInterface $input, OutputInterface $output): int
return 1;
}

$filePath = $_SERVER['SYMFONY_DOTENV_PATH'] ?? $this->projectDirectory.\DIRECTORY_SEPARATOR.'.env';
if (!$filePath = $_SERVER['SYMFONY_DOTENV_PATH'] ?? null) {
$dotenvPath = $this->projectDirectory;

if (is_file($composerFile = $this->projectDirectory.'/composer.json')) {
$runtimeConfig = (json_decode(file_get_contents($composerFile), true))['extra']['runtime'] ?? [];

if (isset($runtimeConfig['dotenv_path'])) {
$dotenvPath = $this->projectDirectory.'/'.$runtimeConfig['dotenv_path'];
}
}

$filePath = $dotenvPath.'/.env';
}

$envFiles = $this->getEnvFiles($filePath);
$availableFiles = array_filter($envFiles, 'is_file');
Expand Down

0 comments on commit 245d1af

Please sign in to comment.