From e6182343839811c17d8d0122d35475c40d592b33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damian=20J=C3=B3=C5=BAwiak?= Date: Wed, 10 Apr 2024 11:44:37 +0200 Subject: [PATCH 1/2] add support for multiple .env files --- src/Commands/InstallCommand.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Commands/InstallCommand.php b/src/Commands/InstallCommand.php index fb26c62..95b99eb 100644 --- a/src/Commands/InstallCommand.php +++ b/src/Commands/InstallCommand.php @@ -36,7 +36,12 @@ public function handle(): void View::render('components.new-line'); - $this->addEnvKeys('.env'); + $optionalEnv = $this->option('env') ?: ''; + $envFile = '.env'; + if ($optionalEnv) { + $envFile .= '.' . $optionalEnv; + } + $this->addEnvKeys($envFile); $this->addEnvKeys('.env.example'); View::render('components.new-line'); @@ -47,7 +52,7 @@ public function handle(): void View::render('components.badge', [ 'type' => 'INFO', - 'content' => 'Open your .env and add your OpenAI API key and organization id.', + 'content' => 'Open your ' . $envFile . ' and add your OpenAI API key and organization id.', ]); if ($wantsToSupport) { From 58254fc6be42951edd71cfa4c54221ea12c62d49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damian=20J=C3=B3=C5=BAwiak?= Date: Wed, 10 Apr 2024 11:48:50 +0200 Subject: [PATCH 2/2] fix style --- src/Commands/InstallCommand.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Commands/InstallCommand.php b/src/Commands/InstallCommand.php index 95b99eb..f52922d 100644 --- a/src/Commands/InstallCommand.php +++ b/src/Commands/InstallCommand.php @@ -39,7 +39,7 @@ public function handle(): void $optionalEnv = $this->option('env') ?: ''; $envFile = '.env'; if ($optionalEnv) { - $envFile .= '.' . $optionalEnv; + $envFile .= '.'.$optionalEnv; } $this->addEnvKeys($envFile); $this->addEnvKeys('.env.example'); @@ -52,7 +52,7 @@ public function handle(): void View::render('components.badge', [ 'type' => 'INFO', - 'content' => 'Open your ' . $envFile . ' and add your OpenAI API key and organization id.', + 'content' => 'Open your '.$envFile.' and add your OpenAI API key and organization id.', ]); if ($wantsToSupport) {