diff options
author | 2021-05-12 17:32:24 +0100 | |
---|---|---|
committer | 2021-05-12 17:32:32 +0100 | |
commit | 3424dd5d1a261fda473ef46666a316c7f32e3de3 (patch) | |
tree | 7fb5b34892da604ab0c6beca96706b3596d657ed /components/pm-subscription-handler/pmsh_service/mod | |
parent | c1eaae6842ebfe15d4ea31bbb41ce5048c5016f6 (diff) |
[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 <antony.saputra@est.tech>
Diffstat (limited to 'components/pm-subscription-handler/pmsh_service/mod')
-rw-r--r-- | components/pm-subscription-handler/pmsh_service/mod/__init__.py | 9 |
1 files changed, 6 insertions, 3 deletions
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(): |