Puppet Function: cfweb::limit_req
- Defined in:
-
lib/puppet/functions/cfweb/limit_req.rb
- Function type:
- Ruby 4.x API
Overview
cfweb::limit_req(String[1] $site, String[1] $name) ⇒ Any
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/puppet/functions/cfweb/limit_req.rb', line 6
Puppet::Functions.create_function(:'cfweb::limit_req') do
dispatch :limit_req do
param 'String[1]', :site
param 'String[1]', :name
end
def limit_req(site, name)
limits = closure_scope["cfweb::nginx::limits"]
overrides = closure_scope.findresource("Cfweb::Site[#{site}]")['limits']
return '' if overrides == 'unlimited'
info = limits.fetch(name, {}).merge(overrides.fetch(name, {}))
return '' if info['disabled']
newname = info.fetch('newname', name)
res = "limit_req zone=#{newname}"
burst = info['burst']
res += " burst=#{burst}" if burst
res += " nodelay" if info['nodelay']
res += ';'
return res
end
end
|