This is an automated email from the ASF dual-hosted git repository.
amoghdesai pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 1ec1e68f6bc Adding flask app configuration docs to FAB provider
(#49492)
1ec1e68f6bc is described below
commit 1ec1e68f6bcd18affa2cad5e72408b7463fa81c0
Author: Amogh Desai <[email protected]>
AuthorDate: Wed Apr 23 16:02:48 2025 +0530
Adding flask app configuration docs to FAB provider (#49492)
* Adding flask app configuration docs to FAB provider
* updating it
* Apply suggestions from code review
Co-authored-by: Vincent <[email protected]>
---------
Co-authored-by: Vincent <[email protected]>
---
.../docs/auth-manager/configuring-flask-app.rst | 38 ++++++++++++++++++++++
providers/fab/docs/auth-manager/index.rst | 1 +
2 files changed, 39 insertions(+)
diff --git a/providers/fab/docs/auth-manager/configuring-flask-app.rst
b/providers/fab/docs/auth-manager/configuring-flask-app.rst
new file mode 100644
index 00000000000..09a9305ade1
--- /dev/null
+++ b/providers/fab/docs/auth-manager/configuring-flask-app.rst
@@ -0,0 +1,38 @@
+ .. Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ .. http://www.apache.org/licenses/LICENSE-2.0
+
+ .. Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+Configuring Flask Application for Airflow Webserver
+===================================================
+
+``FabAuthManager`` and Airflow 2 plugins uses Flask to render the web UI.When
initialized, predefined configuration
+is used, based on the ``webserver`` section of the ``airflow.cfg`` file. You
can override these settings
+and add any extra settings by adding flask configuration to
``webserver_config.py`` file specified in ``[fab] config_file`` (by default it
is ``$AIRFLOW_HOME/webserver_config.py``). This file is automatically loaded by
the webserver.
+
+For example if you would like to change rate limit strategy to "moving
window", you can set the
+``RATELIMIT_STRATEGY`` to ``moving-window``.
+
+You could also enhance / modify the underlying flask app directly,
+as the `app context <https://flask.palletsprojects.com/en/2.3.x/appcontext/>`_
is pushed to ``webserver_config.py``:
+
+.. code-block:: python
+
+ from flask import current_app as app
+
+
+ @app.before_requestq
+ def print_custom_message() -> None:
+ print("Executing before every request")
diff --git a/providers/fab/docs/auth-manager/index.rst
b/providers/fab/docs/auth-manager/index.rst
index 96f9a73172b..3636caa549a 100644
--- a/providers/fab/docs/auth-manager/index.rst
+++ b/providers/fab/docs/auth-manager/index.rst
@@ -30,6 +30,7 @@ Follow the below topics as well to understand other aspects
of FAB auth manager:
* :doc:`access-control`. How FAB auth manager manage users and permissions
* :doc:`webserver-authentication`. To learn the different options available in
FAB auth manager to authenticate users
* :doc:`security`. To learn the different options available in FAB auth
manager to secure the UI provided by FAB auth manager
+* :doc:`configuring-flask-app`. To learn the configuration options available
for the flask app used by ``FabAuthManager``.
.. toctree::
:hidden: