From f6f0a3dd102915b4c5bfdf4f4e3139a8cbf477a0 Mon Sep 17 00:00:00 2001 From: toxxxa Date: Thu, 8 Feb 2024 19:53:17 +0200 Subject: [PATCH] [Dotenv] Specify envKey while loading variables with the dotenv:dump command --- Command/DotenvDumpCommand.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Command/DotenvDumpCommand.php b/Command/DotenvDumpCommand.php index beec603..cd0fb5d 100644 --- a/Command/DotenvDumpCommand.php +++ b/Command/DotenvDumpCommand.php @@ -95,10 +95,11 @@ protected function execute(InputInterface $input, OutputInterface $output): int private function loadEnv(string $dotenvPath, string $env, array $config): array { - $dotenv = new Dotenv(); $envKey = $config['env_var_name'] ?? 'APP_ENV'; $testEnvs = $config['test_envs'] ?? ['test']; + $dotenv = new Dotenv($envKey); + $globalsBackup = [$_SERVER, $_ENV]; unset($_SERVER[$envKey]); $_ENV = [$envKey => $env];