8000 [Dotenv] read runtime config from composer.json in debug dotenv command by xabbuh · Pull Request #59007 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension 10A0D

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/Symfony/Component/Dotenv/Command/DebugCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,17 @@ protected function execute(InputInterface $input, OutputInterface $output): int
return 1;
}

$filePath = $this->projectDirectory.\DIRECTORY_SEPARATOR.'.env';
$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
Loading
0