From 7e4781cb4b9a9d819d8a63423067d6df367f635d Mon Sep 17 00:00:00 2001 From: Adrien Waksberg Date: Tue, 11 Jan 2022 12:28:35 +0100 Subject: [PATCH] feat: add support alpn in bind option --- CHANGELOG.md | 1 + molecule/default/converge.yml | 1 + molecule/default/tests/test_default.py | 1 + templates/haproxy.cfg.j2 | 2 +- 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b5cad34..faf2a21 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ Which is based on [Keep A Changelog](http://keepachangelog.com/) ### Added +- add support alpn in bind option - add error files - use multiple ssl certificates on one frontend diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml index 875afeb..b752cb7 100644 --- a/molecule/default/converge.yml +++ b/molecule/default/converge.yml @@ -44,6 +44,7 @@ bind: ip: '*' port: 5000 + alpn: h2,http/1.1 acl: - url_static path_beg -i /static /images /javascript /stylesheets - url_static path_end -i .jpg .gif .png .css .js diff --git a/molecule/default/tests/test_default.py b/molecule/default/tests/test_default.py index 2f5158b..47470ac 100644 --- a/molecule/default/tests/test_default.py +++ b/molecule/default/tests/test_default.py @@ -11,6 +11,7 @@ def test_config_file(host): assert path.user == 'root' assert path.group == 'root' assert path.mode == 0o640 + assert path.contains('bind \\*:5000 alpn h2,http/1.1') assert path.contains('server host1 127.0.0.1:443 ssl verify none check maxconn 1000 inter 15s') assert path.contains('resolvers dns') diff --git a/templates/haproxy.cfg.j2 b/templates/haproxy.cfg.j2 index 923469b..a228f28 100644 --- a/templates/haproxy.cfg.j2 +++ b/templates/haproxy.cfg.j2 @@ -78,7 +78,7 @@ userlist {{ userlist }} frontend {{ frontend }} {% for key, value in config.items() %} {% if key == "bind" %} - bind {{ value["ip"] }}:{{ value["port"] }}{% if value["ssl"] is defined %} ssl{% if value["ssl"]["ciphers"] is defined %} ciphers {{ value["ssl"]["ciphers"]|join(':') }}{% endif %}{% if value["ssl"]["crt"]%} crt {% if value["ssl"]["crt"] is string %}{{ value["ssl"]["crt"] }}{% else %}{{ value["ssl"]["crt"]|join(' crt ') }}{% endif %}{% endif %} + bind {{ value["ip"] }}:{{ value["port"] }}{% if value["alpn"] is defined %} alpn {{ value["alpn"] }}{% endif %}{% if value["ssl"] is defined %} ssl{% if value["ssl"]["ciphers"] is defined %} ciphers {{ value["ssl"]["ciphers"]|join(':') }}{% endif %}{% if value["ssl"]["crt"]%} crt {% if value["ssl"]["crt"] is string %}{{ value["ssl"]["crt"] }}{% else %}{{ value["ssl"]["crt"]|join(' crt ') }}{% endif %}{% endif %} {% endif %} {% elif value is iterable and value is not string %}