public static function FastlyBackend::validateConfiguration in Acquia Purge 8
Validate the configuration array given.
Parameters
array $config: Associative array with arbitrary settings coming from: \Drupal\acquia_purge\AcquiaCloud\PlatformInfoInterface::getPlatformCdnConfiguration.
Return value
bool Boolean TRUE if the configuration array is valid. When returning FALSE the AcquiaPlatformCdnPurger will not load as a result and cache invalidation will be stopped until the configuration issue got fixed.
Overrides BackendInterface::validateConfiguration
File
- src/
AcquiaPlatformCdn/ FastlyBackend.php, line 333
Class
- FastlyBackend
- Provides a Fastly backend for the Platform CDN purger.
Namespace
Drupal\acquia_purge\AcquiaPlatformCdnCode
public static function validateConfiguration(array $config) {
// Calls to ::validateConfiguration are made very early, and because of this
// it would be too expensive to do any live validation of the given
// token and service_id. Instead, we only verify that they look right and
// let ::fastlyResponseData() make calls to ::setTemporaryRuntimeError()
// so that cache invalidation gets suspended in case of bad API creds.
if (!isset($config['service_id'], $config['token'])) {
return FALSE;
}
if (!(strlen($config['service_id']) && strlen($config['token']))) {
return FALSE;
}
return TRUE;
}