diff --git a/helfi_proxy.install b/helfi_proxy.install index 44d156c..5f0573d 100644 --- a/helfi_proxy.install +++ b/helfi_proxy.install @@ -36,4 +36,30 @@ function helfi_proxy_update_9002() : void { /** @var \Drupal\Core\Config\ConfigInstallerInterface $configInstaller */ $configInstaller = \Drupal::service('config.installer'); $configInstaller->installDefaultConfig('module', 'helfi_proxy'); + + // Re-installing the default configuration does not install purge configuration + // for some reason. + $plugins = \Drupal::configFactory()->getEditable('purge.plugins'); + $purgers = $plugins->get('purgers'); + + if (!array_filter($purgers, fn (array $item) => $item['instance_id'] === 'assets')) { + $purgers[] = [ + 'instance_id' => 'assets', + 'plugin_id' => 'varnish', + 'order_index' => 4, + ]; + $plugins->set('purgers', $purgers) + ->save(); + } + $loggers = \Drupal::configFactory()->getEditable('purge.logger_channels'); + $channels = $loggers->get('channels'); + + if (!array_filter($channels, fn (array $item) => $item['id'] === 'purger_varnish_assets')) { + $channels[] = [ + 'id' => 'purger_varnish_assets', + 'grants' => [0, 2, 3], + ]; + } + $loggers->set('channels', $channels) + ->save(); }