vincbeck commented on code in PR #37555:
URL: https://github.com/apache/airflow/pull/37555#discussion_r1496007419
##########
airflow/cli/commands/internal_api_command.py:
##########
@@ -73,8 +73,8 @@ def internal_api(args):
log.info(f"Starting the Internal API server on port {args.port} and
host {args.hostname}.")
app = create_app(testing=conf.getboolean("core", "unit_test_mode"))
app.run(
- debug=True, # nosec
- use_reloader=not app.config["TESTING"],
+ log_level="debug",
+ # reload=not app.app.config["TESTING"],
Review Comment:
What's the change here?
##########
airflow/providers/fab/auth_manager/fab_auth_manager.py:
##########
@@ -148,21 +150,26 @@ def get_cli_commands() -> list[CLICommand]:
SYNC_PERM_COMMAND, # not in a command group
]
- def get_api_endpoints(self) -> None | Blueprint:
+ def set_api_endpoints(self, connexion_app: connexion.FlaskApp) -> None:
folder = Path(__file__).parents[0].resolve() # this is
airflow/auth/managers/fab/
with folder.joinpath("openapi", "v1.yaml").open() as f:
specification = safe_load(f)
- return FlaskApi(
+
+ swagger_ui_options = SwaggerUIOptions(
+ swagger_ui=conf.getboolean("webserver", "enable_swagger_ui",
fallback=True),
+ )
+
+ api = connexion_app.add_api(
specification=specification,
resolver=_LazyResolver(),
base_path="/auth/fab/v1",
- options={
- "swagger_ui": conf.getboolean("webserver",
"enable_swagger_ui", fallback=True),
- },
+ swagger_ui_options=swagger_ui_options,
strict_validation=True,
validate_responses=True,
- validator_map={"body": _CustomErrorRequestBodyValidator},
- ).blueprint
+ )
+
+ connexion_app.extensions["csrf"].exempt(api.blueprint)
+ return api.blueprint if api else None
Review Comment:
In which case api can be Falsy?
##########
airflow/cli/commands/internal_api_command.py:
##########
@@ -240,11 +241,11 @@ def create_app(config=None, testing=False):
with flask_app.app_context():
init_error_handlers(flask_app)
- init_api_internal(flask_app, standalone_api=True)
+ init_api_internal(connexion_app, standalone_api=True)
init_jinja_globals(flask_app)
init_xframe_protection(flask_app)
- return flask_app
+ return connexion_app
Review Comment:
Why not returning the `flask_app` instead of the `connexion_app`? That would
avoid making many changes around this
##########
airflow/providers/fab/auth_manager/fab_auth_manager.py:
##########
@@ -148,21 +150,26 @@ def get_cli_commands() -> list[CLICommand]:
SYNC_PERM_COMMAND, # not in a command group
]
- def get_api_endpoints(self) -> None | Blueprint:
+ def set_api_endpoints(self, connexion_app: connexion.FlaskApp) -> None:
folder = Path(__file__).parents[0].resolve() # this is
airflow/auth/managers/fab/
with folder.joinpath("openapi", "v1.yaml").open() as f:
specification = safe_load(f)
- return FlaskApi(
+
+ swagger_ui_options = SwaggerUIOptions(
+ swagger_ui=conf.getboolean("webserver", "enable_swagger_ui",
fallback=True),
+ )
Review Comment:
I think this come from another PR? If so please rebase to make the review
easier
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]