Commit 3051a5d2 authored by Manuel's avatar Manuel

refactoring main.py

parent 52f460c3
......@@ -25,6 +25,9 @@ app.add_api(swagger_util.get_bundled_specs(Path("configs/swagger.yml")),
def api_root():
return 'Endpoint of role-stage-discovery-microservice!'
# SSL configuration
context = (f'{modules_path}/certificate/articonf1.crt', f'{modules_path}/certificate/articonf1.key') # certificate and key files
# start app
if __name__ == '__main__':
app.run(host='0.0.0.0', port=5000, debug=True)
app.run(host='0.0.0.0', port=5000, debug=True, ssl_context=context)
from typing import Dict
def decodeToken(token: str) -> Dict:
pass
\ No newline at end of file
......@@ -17,23 +17,13 @@ LOGGER = logging.getLogger(__name__)
#################################
import connexion
from security import swagger_util
# load swagger config
def get_bundled_specs(main_file: Path) -> Dict[str, Any]:
'''
parses the given swagger.yml file and resolves dependencies
from that file to enable the possibility to split the
configuration into several files
'''
parser = prance.ResolvingParser(str(main_file.absolute()),
lazy = True, backend = 'openapi-spec-validator')
parser.parse()
return parser.specification
app = connexion.App(__name__, specification_dir='configs/')
app.add_api(get_bundled_specs(Path("configs/swagger.yml")),
app.add_api(swagger_util.get_bundled_specs(Path("configs/swagger.yml")),
resolver = connexion.RestyResolver("cms_rest_api"))
@app.route('/', methods=['GET'])
......@@ -41,11 +31,8 @@ def api_root():
return 'Endpoint of SMART RESTful API Gateway!'
# SSL configuration
context = ('../../modules/certificate/articonf1.crt', '../../modules/certificate/articonf1.key') # certificate and key files
context = (f'{modules_path}/certificate/articonf1.crt', f'{modules_path}/certificate/articonf1.key') # certificate and key files
# start app
if __name__ == '__main__':
# app.run(host='0.0.0.0', port=5000, debug=True, use_reloader=False) # disable reloader so only subscribed once to rabbitmq
app.run(host='0.0.0.0', port=5000, debug=True, use_reloader=False, ssl_context=context) # disable reloader so only subscribed once to rabbitmq
\ No newline at end of file
flask
connexion[swagger-ui]
pika
deprecated
astroid==2.4.2
attrs==19.3.0
autopep8==1.5.3
bcrypt==3.1.7
certifi==2020.6.20
cffi==1.14.0
chardet==3.0.4
click==7.1.2
clickclick==1.2.2
colorama==0.4.3
connexion==2.7.0
cryptography==2.9.2
Deprecated==1.2.10
Flask==1.1.2
idna==2.10
importlib-metadata==1.7.0
inflection==0.5.0
isort==4.3.21
itsdangerous==1.1.0
Jinja2==2.11.2
jsonschema==3.2.0
lazy-object-proxy==1.4.3
MarkupSafe==1.1.1
mccabe==0.6.1
openapi-spec-validator==0.2.8
pika==1.1.0
prance==0.19.0
pycodestyle==2.6.0
pycparser==2.20
PyJWT==1.7.1
pylint==2.5.3
pymongo==3.10.1
pyOpenSSL==19.1.0
pyrsistent==0.16.0
PyYAML==5.3.1
requests==2.24.0
rope==0.17.0
semver==2.10.2
six==1.15.0
swagger-ui-bundle==0.0.6
toml==0.10.1
typed-ast==1.4.1
urllib3==1.25.9
Werkzeug==1.0.1
wrapt==1.12.1
zipp==3.1.0
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment