1
0
Fork 0

Fix Runtime Errors

This commit is contained in:
Joao Gilberto Magalhaes 2023-02-08 20:29:40 -06:00
parent c3caa3af90
commit cd2a3c6b9c
4 changed files with 10 additions and 9 deletions

View file

@ -5,7 +5,7 @@
| EASYHAPROXY_DISCOVER | How the services will be discovered to create `haproxy.cfg`: `static`, `docker`, `swarm` or `kubernetes` | **required** |
| EASYHAPROXY_LABEL_PREFIX | (Optional) The key will search for matching resources. | `easyhaproxy` |
| EASYHAPROXY_LETSENCRYPT_EMAIL | (Optional) The email will be used to request the certificate to Letsencrypt | *empty* |
| EASYHAPROXY_LETSENCRYPT_SERVER | (Optional) Can be true or 'schema://domain.tld'. If set, will try to connect to the Letsencrypt test server | false |
| EASYHAPROXY_LETSENCRYPT_SERVER | (Optional) Can be `staging` or 'schema://domain.tld'. If set, will try to connect to the Letsencrypt test server | *empty* |
| EASYHAPROXY_SSL_MODE | (Optional) `strict` supports only the most recent TLS version; `default` good SSL integration with recent browsers; `loose` supports all old SSL protocols for old browsers (not recommended). | `default`|
| EASYHAPROXY_REFRESH_CONF | (Optional) Check configuration every N seconds. | 10 |
| EASYHAPROXY_LOG_LEVEL | (Optional) The log level for EasyHAproxy messages. Available: TRACE,DEBUG,INFO,WARN,ERROR,FATAL | DEBUG |

View file

@ -21,4 +21,4 @@ version: 0.1.4
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "4.3.0"
appVersion: "4.2.0"

View file

@ -180,13 +180,12 @@ class Certbot:
self.test_server = self.set_test_server(test_server)
def set_test_server(self, test_server):
if not test_server:
return ""
if test_server.lower() in ["true", "1", "yes"]:
if test_server.lower() == "staging":
return "--staging"
else:
elif test_server.lower().startswith("http"):
return "--server " + test_server
else:
return ""
def check_certificates(self, hosts):
if self.email == "" or len(hosts) == 0:
@ -247,6 +246,8 @@ class Certbot:
def find_live_certificates(self):
letsencrypt_certs = "/etc/letsencrypt/live/"
if not os.path.exists(letsencrypt_certs):
return
for item in os.listdir(letsencrypt_certs):
path = os.path.join(letsencrypt_certs, item)
if os.path.isdir(path):

View file

@ -22,7 +22,7 @@ def start():
haproxy.haproxy("start")
haproxy.sleep()
certbot = Certbot(Consts.certs_letsencrypt, os.getenv("EASYHAPROXY_LETSENCRYPT_EMAIL"), os.getenv("EASYHAPROXY_LETSENCRYPT_SERVER", "false").lower())
certbot = Certbot(Consts.certs_letsencrypt, os.getenv("EASYHAPROXY_LETSENCRYPT_EMAIL"), os.getenv("EASYHAPROXY_LETSENCRYPT_SERVER", "").lower())
while True:
if old_haproxy is not None:
@ -70,4 +70,4 @@ def main():
start()
if __name__ == '__main__':
main()
main()