File tree Expand file tree Collapse file tree 3 files changed +36
-1
lines changed
Expand file tree Collapse file tree 3 files changed +36
-1
lines changed Original file line number Diff line number Diff line change 1+ # -*- coding: utf-8 -*-
2+
3+ def flatten (d , separator = '.' ):
4+ """
5+ Flatten a dictionary `d` by joining nested keys with `separator`.
6+
7+ Slightly modified from <http://codereview.stackexchange.com/a/21035>.
8+
9+ >>> flatten({'eggs': 'spam', 'sausage': {'eggs': 'bacon'}, 'spam': {'bacon': {'sausage': 'spam'}}})
10+ {'spam.bacon.sausage': 'spam', 'eggs': 'spam', 'sausage.eggs': 'bacon'}
11+ """
12+ def items ():
13+ for k , v in d .items ():
14+ try :
15+ for sub_k , sub_v in flatten (v , separator ).items ():
16+ yield separator .join ([k , sub_k ]), sub_v
17+ except AttributeError :
18+ yield k , v
19+ return dict (items ())
20+
21+
22+ class FilterModule (object ):
23+ def filters (self ):
24+ return {'flatten' : flatten }
Original file line number Diff line number Diff line change 5050{% endif -%}
5151{% if haproxy_global.ssl_default_bind_ciphers is defined %}
5252 ssl-default-bind-ciphers {{ haproxy_global.ssl_default_bind_ciphers }}
53- {% endif -%}
53+ {% endif -%}
54+ {% if haproxy_global.tune is defined %}
55+ {% for param, value in (haproxy_global.tune | flatten).items() -%}
56+ tune.{{ param }} {{ value }}
57+ {% endfor -%}
58+ {% endif %}
Original file line number Diff line number Diff line change @@ -23,6 +23,12 @@ empty: true
2323# format:
2424# ssl_default_bind_options:
2525# ssl_default_bind_ciphers:
26+ # tune:
27+ # chksize: 32768
28+ # ssl:
29+ # default-dh-param: 2048
30+ # zlib:
31+ # memlevel: 9
2632#
2733# haproxy_defaults:
2834# mode:
You can’t perform that action at this time.
0 commit comments