-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsuperset_config.py
85 lines (74 loc) · 2.49 KB
/
superset_config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import os
_conn_str = (
os.getenv("SQLALCHEMY_DATABASE_URI") or os.getenv("POSTGRESQL_ADDON_URI") or ""
)
SQLALCHEMY_DATABASE_URI = _conn_str.replace('"', "").replace("'", "")
ENABLE_PROXY_FIX = True
PROXY_FIX_CONFIG = {
"x_for": 1,
"x_proto": 0,
"x_host": 1,
"x_port": 0,
"x_prefix": 0,
}
FEATURE_FLAGS = {
"EMBEDDED_SUPERSET": True,
"EMBEDDABLE_CHARTS": True,
"DASHBOARD_RBAC": True,
}
# Almost like Gamma, but we removed
# "Can share Dahsboard"
# "Can share chart"
# "Can explore json on superset"
# "Can explore on superset"
# "Can save on superset"
# "Can copy on superset"
# TODO(vperron): Create the "embed" role at startup ?
# It seems that `superset fab` can import role files.
# We can also just acknowledge that this is a production setting ?
GUEST_ROLE_NAME = "Embed"
GUEST_TOKEN_JWT_SECRET = os.getenv("GUEST_TOKEN_JWT_SECRET")
TALISMAN_ENABLED = True
TALISMAN_CONFIG = {
"content_security_policy": {
"default-src": ["'self'", "'unsafe-inline'", "'unsafe-eval'"],
"img-src": ["'self'", "'unsafe-inline'", "data:"],
"worker-src": ["'self'", "blob:"],
"connect-src": [
"'self'",
"https://api.mapbox.com",
"https://events.mapbox.com",
],
"object-src": "'none'",
"frame-src": ["'self'", "http://127.0.0.1:8000"],
"frame-ancestors": ["'self'", "http://127.0.0.1:8000"],
}
}
REDIS_URL = os.getenv("REDIS_URL")
if REDIS_URL:
from datetime import timedelta
CACHE_CONFIG = {
"CACHE_TYPE": "RedisCache",
"CACHE_DEFAULT_TIMEOUT": int(timedelta(days=1).total_seconds()),
"CACHE_KEY_PREFIX": "superset_cache_",
"CACHE_REDIS_URL": f"{REDIS_URL}/0",
}
# Cache for datasource metadata and query results
DATA_CACHE_CONFIG = {
"CACHE_TYPE": "RedisCache",
"CACHE_DEFAULT_TIMEOUT": int(timedelta(days=1).total_seconds()),
"CACHE_KEY_PREFIX": "superset_data_",
"CACHE_REDIS_URL": f"{REDIS_URL}/0",
}
FILTER_STATE_CACHE_CONFIG = {
"CACHE_TYPE": "RedisCache",
"CACHE_DEFAULT_TIMEOUT": int(timedelta(days=1).total_seconds()),
"CACHE_KEY_PREFIX": "superset_filter_",
"CACHE_REDIS_URL": f"{REDIS_URL}/0",
}
EXPLORE_FORM_DATA_CACHE_CONFIG = {
"CACHE_TYPE": "RedisCache",
"CACHE_DEFAULT_TIMEOUT": int(timedelta(days=1).total_seconds()),
"CACHE_KEY_PREFIX": "superset_explore_",
"CACHE_REDIS_URL": f"{REDIS_URL}/0",
}