From e9f2fba02195967ce1291aa100ad3144dcd9eb47 Mon Sep 17 00:00:00 2001 From: Laurent Peuch Date: Fri, 24 Aug 2018 14:55:04 +0200 Subject: [PATCH] [enh] backport possibility to run with ssl --- run.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/run.py b/run.py index a367d92..20893b6 100644 --- a/run.py +++ b/run.py @@ -394,14 +394,23 @@ async def index(request): return {} -def main(path_to_analyseCI): +def main(path_to_analyseCI, ssl=False, keyfile_path="/etc/yunohost/certs/ci-apps.yunohost.org/key.pem", certfile_path="/etc/yunohost/certs/ci-apps.yunohost.org/crt.pem"): reset_pending_jobs() reset_busy_workers() app.config.path_to_analyseCI = path_to_analyseCI app.add_task(monitor_apps_lists()) app.add_task(jobs_dispatcher()) - app.run('localhost', port=4242, debug=True) + + if not ssl: + app.run('localhost', port=4242, debug=True) + else: + import ssl + context = ssl.create_default_context(purpose=ssl.Purpose.CLIENT_AUTH) + context.load_cert_chain(certfile_path, keyfile=keyfile_path) + + app.run('0.0.0.0', port=4242, ssl=context, debug=True) + if __name__ == "__main__":