Skip to content

Commit e41a470

Browse files
authored
Merge pull request #270 from imdhemy/step-setting-google-app-creds-twice
[1.x] Stop setting Credentials path twice
2 parents d008441 + 6420e6d commit e41a470

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/ServiceProviders/LiapServiceProvider.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,13 @@ private function registerConfig(): void
112112
{
113113
$this->mergeConfigFrom(self::CONFIG_PATH, self::CONFIG_KEY);
114114

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

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

0 commit comments

Comments
 (0)