Puppet Function: cfweb::limit_conn
- Defined in:
- lib/puppet/functions/cfweb/limit_conn.rb
- Function type:
- Ruby 4.x API
Overview
Copyright 2016-2019 © Andrey Galkin
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/puppet/functions/cfweb/limit_conn.rb', line 5 Puppet::Functions.create_function(:'cfweb::limit_conn') do dispatch :limit_conn do param 'String[1]', :site param 'String[1]', :name end def limit_conn(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) return "limit_conn #{newname} #{info['count']};" end end |