diff --git a/README.md b/README.md index cc6f8e6..e53fdbc 100644 --- a/README.md +++ b/README.md @@ -197,7 +197,6 @@ easymapping: host2.com.br: containers: - other:3000 - ssl: false redirect: www.host1.com.br: http://host1.com.br @@ -207,7 +206,7 @@ easymapping: containers: - container:80 redirect-ssl: false - ssl: true + ssl: true - port: 8080 hosts: diff --git a/easymapping/__init__.py b/easymapping/__init__.py index 2516cca..a10fa2f 100644 --- a/easymapping/__init__.py +++ b/easymapping/__init__.py @@ -165,7 +165,7 @@ class HaproxyConfigGenerator: easymapping["443"]["hosts"][hostname] = dict(easymapping[port]["hosts"][hostname]) easymapping["443"]["hosts"][hostname]["letsencrypt"] = False easymapping["443"]["hosts"][hostname]["redirect_ssl"] = False - easymapping["443"]["ssl_cert"] = self.ssl_cert_letsecncrypt + easymapping["443"]["ssl"] = True self.letsencrypt_hosts.append(hostname) if hostname not in self.letsencrypt_hosts else self.letsencrypt_hosts @@ -175,12 +175,12 @@ class HaproxyConfigGenerator: filename = "{}/{}.pem".format( self.ssl_cert_haproxy, d[host_label] ) - easymapping[port]["ssl_cert"] = filename + easymapping[port]["ssl"] = True with open(filename, 'wb') as file: file.write( base64.b64decode(d[ssl_label]) ) if self.label.get_bool(self.label.create([definition, "ssl"])): - easymapping[port]["ssl_cert"] = self.ssl_cert_haproxy + easymapping[port]["ssl"] = True return easymapping.values() diff --git a/examples/static/config.yml b/examples/static/config.yml index f3d9073..a3e2d18 100644 --- a/examples/static/config.yml +++ b/examples/static/config.yml @@ -12,7 +12,7 @@ easymapping: www.host1.local: https://host1.local - port: 443 - ssl_cert: /certs/haproxy/host1.local.pem + ssl: true hosts: host1.local: containers: diff --git a/templates/bind.j2 b/templates/bind.j2 index aba571c..d33d4bd 100644 --- a/templates/bind.j2 +++ b/templates/bind.j2 @@ -1,4 +1,4 @@ - {% if "ssl_cert" in o %} + {% if "ssl" in o %} bind *:{{ o["port"] }} ssl crt /certs/letsencrypt/ alpn http/1.1 crt /certs/haproxy/ alpn http/1.1 {% elif "h2" in o and o["h2"] %} bind *:{{ o["port"] }} proto h2 diff --git a/tests/fixtures/static.yml b/tests/fixtures/static.yml index 90c2b1d..c83d61c 100644 --- a/tests/fixtures/static.yml +++ b/tests/fixtures/static.yml @@ -19,7 +19,7 @@ easymapping: www.host1.com.br: http://host1.com.br - port: 443 - ssl_cert: /certs/haproxy/mycert.pem + ssl: True hosts: host1.com.br: containers: diff --git a/tests/test_parser.py b/tests/test_parser.py index 75541f3..83028ba 100644 --- a/tests/test_parser.py +++ b/tests/test_parser.py @@ -168,7 +168,7 @@ def test_parser_finds_services_raw(): "byjg.ca":"https://www.somehost.com.br", "www.byjg.ca":"https://www.somehost.com.br" }, - "ssl_cert":CERT_FILE + "ssl": True }, { "mode":"http", @@ -247,7 +247,7 @@ def test_parser_static_raw(): }, { "port": 443, - "ssl_cert": "/certs/haproxy/mycert.pem", + "ssl": True, "hosts": { "host1.com.br": { "containers": [