Skip to content

Commit 717df35

Browse files
update
1 parent 220a54a commit 717df35

File tree

1 file changed

+50
-5
lines changed

1 file changed

+50
-5
lines changed

src/website/core/settings.py

+50-5
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ def require_env_var(env_var: str) -> str:
5252
# Core Settings
5353
# ---------------------------------------------------------
5454
SECRET_KEY = require_env_var('SECRET_KEY')
55-
# DEBUG = get_env_bool('DEBUG', default=False)
56-
DEBUG = True
55+
DEBUG = get_env_bool('DEBUG', default=False)
5756

5857
# ALLOWED_HOSTS = parse_env_list("ALLOWED_HOSTS")
5958
ALLOWED_HOSTS = ['*']
@@ -131,11 +130,57 @@ def require_env_var(env_var: str) -> str:
131130
else:
132131
# Restrict CORS origins in production
133132
CORS_ORIGIN_ALLOW_ALL = False
134-
CORS_ALLOWED_ORIGINS = parse_env_list("CORS_ALLOWED_ORIGINS")
135-
CORS_ORIGIN_REGEX_WHITELIST = parse_env_list("CORS_ORIGIN_REGEX_WHITELIST")
133+
CORS_ALLOWED_ORIGINS = [
134+
"https://staging-dot-airqo-frontend.appspot.com",
135+
"https://staging.airqo.net",
136+
"https://airqo.net",
137+
"https://airqo.africa",
138+
"https://airqo.org",
139+
"https://airqo.mak.ac.ug",
140+
"http://127.0.0.1:8000",
141+
"http://localhost:3000",
142+
"https://staging-platform.airqo.net",
143+
"https://staging-analytics.airqo.net",
144+
"https://analytics.airqo.net",
145+
"https://platform.airqo.net",
146+
]
147+
CORS_ORIGIN_REGEX_WHITELIST = [
148+
# Matches subdomains under airqo.net, airqo.africa, airqo.org, airqo.io
149+
r"^https://[a-zA-Z0-9_\-]+\.airqo\.(net|africa|org|io)$",
150+
# Matches airqo.africa, airqo.org, and airqo.mak.ac.ug
151+
r"^https://airqo\.(africa|org|mak\.ac\.ug)$",
152+
# Matches staging-dot-airqo-frontend.appspot.com
153+
r"^https://staging-dot-airqo-frontend\.appspot\.com$",
154+
r"^https://staging-platform\.airqo\.net$", # Matches staging-platform.airqo.net
155+
# Matches staging-analytics.airqo.net
156+
r"^https://staging-analytics\.airqo\.net$",
157+
r"^https://analytics\.airqo\.net$", # Matches analytics.airqo.net
158+
r"^https://platform\.airqo\.net$", # Matches platform.airqo.net
159+
# Matches any subpath under https://platform.airqo.net/website/admin
160+
r"^https://platform\.airqo\.net/website/admin.*$",
161+
# Matches any subpath under https://staging-platform.airqo.net/website/admin
162+
r"^https://staging-platform\.airqo\.net/website/admin.*$",
163+
]
136164

137165
# Trust specific origins for CSRF protection in production
138-
CSRF_TRUSTED_ORIGINS = parse_env_list("CSRF_TRUSTED_ORIGINS")
166+
# CSRF_TRUSTED_ORIGINS = parse_env_list("CSRF_TRUSTED_ORIGINS")
167+
CSRF_TRUSTED_ORIGINS = [
168+
"https://staging-dot-airqo-frontend.appspot.com",
169+
"https://staging.airqo.net",
170+
"https://airqo.net",
171+
"https://airqo.africa",
172+
"https://airqo.org",
173+
"https://airqo.mak.ac.ug",
174+
"http://127.0.0.1:8000",
175+
"http://localhost:3000",
176+
"https://*.cloudshell.dev",
177+
"https://staging-platform.airqo.net",
178+
"https://staging-analytics.airqo.net",
179+
"https://analytics.airqo.net",
180+
"https://platform.airqo.net",
181+
"https://website-trigger-3-website-preview-w7kzhvlewq-ew.a.run.app",
182+
]
183+
139184

140185
# Security settings
141186
CSRF_COOKIE_SECURE = not DEBUG

0 commit comments

Comments
 (0)