Skip to content

Commit

Permalink
Merge pull request #270 from imdhemy/step-setting-google-app-creds-twice
Browse files Browse the repository at this point in the history
[1.x] Stop setting Credentials path twice
  • Loading branch information
imdhemy authored Jan 28, 2023
2 parents d008441 + 6420e6d commit e41a470
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/ServiceProviders/LiapServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,13 @@ private function registerConfig(): void
{
$this->mergeConfigFrom(self::CONFIG_PATH, self::CONFIG_KEY);

$googleCredentials = (string)config(self::CONFIG_KEY.'.google_application_credentials');
// Check if it should set GOOGLE_APPLICATION_CREDENTIALS to the configured path
$currentGoogleCredPath = getenv('GOOGLE_APPLICATION_CREDENTIALS');
if ($currentGoogleCredPath && file_exists($currentGoogleCredPath)) {
return;
}

$googleCredentials = (string)config(self::CONFIG_KEY.'.google_application_credentials');
if (! empty($googleCredentials) && ! is_dir($googleCredentials)) {
if (! file_exists($googleCredentials)) {
throw new RuntimeException("Google Application Credentials file not found at $googleCredentials");
Expand Down

0 comments on commit e41a470

Please sign in to comment.