Defined Type: profile::cache::varnish::known_client_rate_limits_file

Defined in:
modules/profile/manifests/cache/varnish/known_client_rate_limits_file.pp

Summary

define to generate a known-client rate limits file

Overview

SPDX-License-Identifier: Apache-2.0

Parameters:

  • conftool_prefix (String) —

    the prefix to use for conftool

  • cache_cluster (Enum['text', 'upload']) —

    name of cache cluster e.g. upload or text

  • reload_vcl_opts (String) —

    options for the reload of VCL



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'modules/profile/manifests/cache/varnish/known_client_rate_limits_file.pp', line 6

define profile::cache::varnish::known_client_rate_limits_file (
    String $conftool_prefix,
    Enum['text', 'upload'] $cache_cluster,
    String $reload_vcl_opts,
) {
    $safe_title = $title.regsubst('\W', '-', 'G')
    confd::file { "/etc/varnish/${safe_title}.inc.vcl":
        ensure     => present,
        reload     => "/usr/local/bin/confd-reload-vcl varnish-frontend ${reload_vcl_opts}",
        before     => Service['varnish-frontend'],
        watch_keys => ['/request-known-clients'],
        content    => template('profile/cache/varnish-frontend-known-client-rate-limits.hp.vcl.tpl.erb'),
        prefix     => $conftool_prefix;
    }
    confd::file { "/etc/varnish/${safe_title}.hp.incl.vcl":
        ensure     => absent,
        reload     => "/usr/local/bin/confd-reload-vcl varnish-frontend ${reload_vcl_opts}",
        before     => Service['varnish-frontend'],
        watch_keys => ["/request-varnish-known-client-ratelimits/${cache_cluster}"],
        prefix     => $conftool_prefix;
    }
}