Skip to content

Commit 9c00838

Browse files
authored
Merge pull request #69 from dpfaffenbauer/patch-1
Allow no auth_config for Google Index Worker
2 parents dfbdb9d + fc44bea commit 9c00838

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/Worker/GoogleIndexWorker.php

+7-4
Original file line numberDiff line numberDiff line change
@@ -215,11 +215,14 @@ protected function getUrlType(string $type): string
215215
*/
216216
protected function getClient(): \Google_Client
217217
{
218-
$configPath = sprintf('%s/%s', PIMCORE_PROJECT_ROOT, ltrim($this->configuration['auth_config'], '/'));
219-
220218
$client = new \Google_Client();
221219
$client->setScopes(\Google_Service_Indexing::INDEXING);
222-
$client->setAuthConfig($configPath);
220+
221+
if ($this->configuration['auth_config']) {
222+
$configPath = sprintf('%s/%s', PIMCORE_PROJECT_ROOT, ltrim($this->configuration['auth_config'], '/'));
223+
$client->setAuthConfig($configPath);
224+
}
225+
223226
$client->setUseBatch(true);
224227

225228
return $client;
@@ -240,7 +243,7 @@ public static function configureOptions(OptionsResolver $resolver): void
240243

241244
$resolver->setAllowedTypes('push_requests_per_day', 'int');
242245
$resolver->setAllowedTypes('push_requests_per_minute', 'int');
243-
$resolver->setAllowedTypes('auth_config', 'string');
246+
$resolver->setAllowedTypes('auth_config', ['string', 'null']);
244247
$resolver->setRequired(['push_requests_per_day', 'push_requests_per_minute', 'auth_config']);
245248
}
246249
}

0 commit comments

Comments
 (0)