Skip to content

Commit

Permalink
read runtime config from composer.json in debug dotenv command
Browse files Browse the repository at this point in the history
  • Loading branch information
xabbuh committed Nov 27, 2024
1 parent 4cb5f06 commit 0801340
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion 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

0 comments on commit 0801340

Please sign in to comment.