X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=o2app%2Fentrypoints%2Fflask_application.py;h=fb4b6a220602e43e7d1edefa3b0d41cbdb84a1de;hb=HEAD;hp=e464de302fa69516590ca05e26feec946b4e660c;hpb=748a90298e8abff7f1ff2fdec6a36c2775fe7161;p=pti%2Fo2.git diff --git a/o2app/entrypoints/flask_application.py b/o2app/entrypoints/flask_application.py index e464de3..fb4b6a2 100644 --- a/o2app/entrypoints/flask_application.py +++ b/o2app/entrypoints/flask_application.py @@ -22,28 +22,17 @@ from o2common.views.route_exception import configure_exception from o2common.authmw import authmiddleware from o2common.authmw import authprov -from o2common.config.config import get_review_url from o2common.helper import o2logging +AUTH_ENABLED = True +FLASK_API_VERSION = '1.0.0' + # apibase = config.get_o2ims_api_base() -auth = True app = Flask(__name__) logger = o2logging.get_logger(__name__) - -def _get_k8s_url(): - try: - token_review_url = get_review_url() - return token_review_url - except Exception: - raise Exception('Get k8s token review url failed') - - -FLASK_API_VERSION = '1.0.0' - -if auth: +if AUTH_ENABLED: # perform service account identity&privilege check. - _get_k8s_url() ad = authprov.auth_definer('ad') ad.sanity_check() app.wsgi_app = authmiddleware.authmiddleware(app.wsgi_app) @@ -52,9 +41,11 @@ app.config.SWAGGER_UI_DOC_EXPANSION = 'list' # app.config['RESTX_MASK_HEADER'] = 'fields' app.config['RESTX_MASK_SWAGGER'] = False app.config['ERROR_INCLUDE_MESSAGE'] = False -api = Api(app, version=FLASK_API_VERSION, - title='INF O2 Services API', - description='Swagger OpenAPI document for the INF O2 Services', +api = Api( + app, version=FLASK_API_VERSION, + catch_all_404s=True, + title='INF O2 Services API', + description='Swagger OpenAPI document for the INF O2 Services', ) bus = bootstrap.bootstrap()