From 44db7b4847290227cd2289c6697d19b7ff0faf6e Mon Sep 17 00:00:00 2001 From: 1day2die Date: Fri, 5 May 2023 12:01:57 +0200 Subject: [PATCH] Update AppServiceProvider.php --- app/Providers/AppServiceProvider.php | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 4bd88d89..8b82efad 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -60,6 +60,21 @@ class AppServiceProvider extends ServiceProvider URL::forceScheme('https'); } + //get the Github Branch the panel is running on + try { + $stringfromfile = file(base_path() . '/.git/HEAD'); + + $firstLine = $stringfromfile[0]; //get the string from the array + + $explodedstring = explode('/', $firstLine, 3); //seperate out by the "/" in the string + + $branchname = $explodedstring[2]; //get the one that is always the branch name + } catch (Exception $e) { + $branchname = 'unknown'; + Log::notice($e); + } + config(['BRANCHNAME' => $branchname]); + // Do not run this code if no APP_KEY is set if (config('app.key') == null) return; @@ -76,18 +91,5 @@ class AppServiceProvider extends ServiceProvider $settings = $this->app->make(MailSettings::class); $settings->setConfig(); - try { - $stringfromfile = file(base_path() . '/.git/HEAD'); - - $firstLine = $stringfromfile[0]; //get the string from the array - - $explodedstring = explode('/', $firstLine, 3); //seperate out by the "/" in the string - - $branchname = $explodedstring[2]; //get the one that is always the branch name - } catch (Exception $e) { - $branchname = 'unknown'; - Log::notice($e); - } - config(['BRANCHNAME' => $branchname]); } }