Update AppServiceProvider.php (#813)
This commit is contained in:
commit
f8d7919a43
|
@ -60,6 +60,21 @@ class AppServiceProvider extends ServiceProvider
|
||||||
URL::forceScheme('https');
|
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
|
// Do not run this code if no APP_KEY is set
|
||||||
if (config('app.key') == null) return;
|
if (config('app.key') == null) return;
|
||||||
|
|
||||||
|
@ -76,18 +91,5 @@ class AppServiceProvider extends ServiceProvider
|
||||||
$settings = $this->app->make(MailSettings::class);
|
$settings = $this->app->make(MailSettings::class);
|
||||||
$settings->setConfig();
|
$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]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue