From ce725e06a79b4efb75c86286c44a479052a7033e Mon Sep 17 00:00:00 2001 From: Ke Zhu Date: Fri, 20 Aug 2021 12:54:46 -0400 Subject: [PATCH] docs: document FLASK_APP_MUTATOR (#16286) --- .../pages/docs/installation/configuring.mdx | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/docs/src/pages/docs/installation/configuring.mdx b/docs/src/pages/docs/installation/configuring.mdx index 2c141d4dd50c8..707aaeef7209e 100644 --- a/docs/src/pages/docs/installation/configuring.mdx +++ b/docs/src/pages/docs/installation/configuring.mdx @@ -201,6 +201,25 @@ CUSTOM_SECURITY_MANAGER = CustomSsoSecurityManager ] ``` +### Flask app Configuration Hook + +`FLASK_APP_MUTATOR` is a configuration function that can be provided in your environment, receives +the app object and can alter it in any way. For example, add `FLASK_APP_MUTATOR` into your +`superset_config.py` to setup session cookie expiration time to 24 hours: + +``` +def make_session_permanent(): + ''' + Enable maxAge for the cookie 'session' + ''' + session.permanent = True + +# Set up max age of session to 24 hours +PERMANENT_SESSION_LIFETIME = timedelta(hours=24) +def FLASK_APP_MUTATOR(app: Flask) -> None: + app.before_request_funcs.setdefault(None, []).append(make_session_permanent) +``` + ### Feature Flags To support a diverse set of users, Superset has some features that are not enabled by default. For