From 3424dd5d1a261fda473ef46666a316c7f32e3de3 Mon Sep 17 00:00:00 2001 From: antonys Date: Wed, 12 May 2021 17:32:24 +0100 Subject: [PMSH] Change Flask web server to Tornado web server - Tornado is more suitable web server for production environment Issue-ID: DCAEGEN2-2767 Change-Id: I81c65a3cc668cbd42132f23e908f12cec371ae66 Signed-off-by: antonys --- components/pm-subscription-handler/pmsh_service/mod/__init__.py | 9 ++++++--- components/pm-subscription-handler/setup.py | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'components/pm-subscription-handler') diff --git a/components/pm-subscription-handler/pmsh_service/mod/__init__.py b/components/pm-subscription-handler/pmsh_service/mod/__init__.py index 505add06..5f78ca19 100644 --- a/components/pm-subscription-handler/pmsh_service/mod/__init__.py +++ b/components/pm-subscription-handler/pmsh_service/mod/__init__.py @@ -1,5 +1,5 @@ # ============LICENSE_START=================================================== -# Copyright (C) 2019-2020 Nordix Foundation. +# Copyright (C) 2019-2021 Nordix Foundation. # ============================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,6 +17,7 @@ # ============LICENSE_END===================================================== import logging as logging import os +import ssl import pathlib from urllib.parse import quote @@ -44,11 +45,13 @@ def launch_api_server(app_config): connex_app.add_api('api/pmsh_swagger.yml') if app_config.enable_tls: logger.info('Launching secure http API server') + ssl_ctx = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH) + ssl_ctx.load_cert_chain(app_config.cert_params[0], app_config.cert_params[1]) connex_app.run(port=os.environ.get('PMSH_API_PORT', '8443'), - ssl_context=app_config.cert_params) + ssl_options=ssl_ctx, server="tornado") else: logger.info('Launching unsecure http API server') - connex_app.run(port=os.environ.get('PMSH_API_PORT', '8443')) + connex_app.run(port=os.environ.get('PMSH_API_PORT', '8443'), server="tornado") def create_app(): diff --git a/components/pm-subscription-handler/setup.py b/components/pm-subscription-handler/setup.py index e4d31332..c11d1330 100644 --- a/components/pm-subscription-handler/setup.py +++ b/components/pm-subscription-handler/setup.py @@ -35,6 +35,7 @@ setup( "connexion==2.5.0", "flask_sqlalchemy==2.4.1", "Flask==1.1.1", + "tornado==6.1", "swagger-ui-bundle==0.0.6", "psycopg2-binary==2.8.6", "onap_dcae_cbs_docker_client==2.1.1", -- cgit 1.2.3-korg