Commit 34d17494 authored by Alexander Lercher's avatar Alexander Lercher

Added config to run role-stage-discovery locally

parent 4caa4224
...@@ -15,11 +15,10 @@ LOGGER = logging.getLogger(__name__) ...@@ -15,11 +15,10 @@ LOGGER = logging.getLogger(__name__)
import connexion import connexion
from security import swagger_util from security import swagger_util
from pathlib import Path from pathlib import Path
from env_info import is_running_locally
# load swagger config # load swagger config
app = connexion.App(__name__, specification_dir='configs/') app = connexion.App(__name__, specification_dir='configs/')
app.add_api(swagger_util.get_bundled_specs(Path("configs/swagger.yml")),
resolver = connexion.RestyResolver("cms_rest_api"))
@app.route('/', methods=['GET']) @app.route('/', methods=['GET'])
def api_root(): def api_root():
...@@ -33,6 +32,16 @@ except KeyError: ...@@ -33,6 +32,16 @@ except KeyError:
certificate_path = '/srv/articonf/' certificate_path = '/srv/articonf/'
context = (os.path.normpath(f'{certificate_path}/articonf1.crt'), os.path.normpath(f'{certificate_path}/articonf1.key')) # certificate and key files context = (os.path.normpath(f'{certificate_path}/articonf1.crt'), os.path.normpath(f'{certificate_path}/articonf1.key')) # certificate and key files
if is_running_locally():
# Local Mode
print("Running with local settings...")
app.add_api(swagger_util.get_bundled_specs(Path("configs/swagger_local.yml")),
resolver = connexion.RestyResolver("cms_rest_api"))
context = 'adhoc'
else:
app.add_api(swagger_util.get_bundled_specs(Path("configs/swagger.yml")),
resolver = connexion.RestyResolver("cms_rest_api"))
# start app # start app
if __name__ == '__main__': if __name__ == '__main__':
app.run(host='0.0.0.0', port=5000, ssl_context=context) app.run(host='0.0.0.0', port=5000, ssl_context=context)
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