superset-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From michel...@apache.org
Subject [incubator-superset] 11/13: Talisman config (#7529)
Date Sat, 01 Jun 2019 01:28:25 GMT
This is an automated email from the ASF dual-hosted git repository.

michellet pushed a commit to branch release--0.33
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git

commit 23842e43a448f78be89b0bdfc51713c4a45e633e
Author: Craig Rueda <craig@craigrueda.com>
AuthorDate: Thu May 16 20:55:59 2019 -0700

    Talisman config (#7529)
    
    * Making Talisman configurable
    
    * Fixing double quotes
    
    * Fixing flake8
    
    * Removing default
    
    (cherry picked from commit 21a467094ba3e194b9799026f0706c5453a5fb1e)
---
 superset/__init__.py | 4 +++-
 superset/config.py   | 9 +++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/superset/__init__.py b/superset/__init__.py
index 217d0a5..c995c2f 100644
--- a/superset/__init__.py
+++ b/superset/__init__.py
@@ -229,7 +229,9 @@ def is_feature_enabled(feature):
 if conf.get('ENABLE_FLASK_COMPRESS'):
     Compress(app)
 
-Talisman(app, content_security_policy=None)
+if app.config['TALISMAN_ENABLED']:
+    talisman_config = app.config.get('TALISMAN_CONFIG')
+    Talisman(app, **talisman_config)
 
 # Hook that provides administrators a handle on the Flask APP
 # after initialization
diff --git a/superset/config.py b/superset/config.py
index b1052fe..8d11f0b 100644
--- a/superset/config.py
+++ b/superset/config.py
@@ -600,6 +600,15 @@ DEFAULT_RELATIVE_END_TIME = 'today'
 IS_EPOCH_S_TRULY_UTC = False
 
 
+# Do you want Talisman enabled?
+TALISMAN_ENABLED = True
+# If you want Talisman, how do you want it configured??
+TALISMAN_CONFIG = {
+    'content_security_policy': None,
+    'force_https': True,
+    'force_https_permanent': False,
+}
+
 try:
     if CONFIG_PATH_ENV_VAR in os.environ:
         # Explicitly import config module that is not in pythonpath; useful


Mime
View raw message