diff --git a/Command/DebugCommand.php b/Command/DebugCommand.php index 237d7b7..eb9fe46 100644 --- a/Command/DebugCommand.php +++ b/Command/DebugCommand.php @@ -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');