diff options
author | 2020-12-14 18:52:53 +0000 | |
---|---|---|
committer | 2020-12-14 18:52:53 +0000 | |
commit | bb061a6843ae8f6d18dfed970c1b2e0bc683de33 (patch) | |
tree | 3f097d05e9f6ee533d06a1cfcc47423f7ef8db32 | |
parent | Change how the ALLOWED_HOSTS environment variable sets CORS (diff) |
Shorten var name to meet flake8 limits:
-rw-r--r-- | backend/__init__.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/backend/__init__.py b/backend/__init__.py index f285166..adf304d 100644 --- a/backend/__init__.py +++ b/backend/__init__.py @@ -9,14 +9,14 @@ from backend.authentication import JWTAuthenticationBackend from backend.route_manager import create_route_map from backend.middleware import DatabaseMiddleware -HOSTS_REGEX = r"https://(?:(?:(?:.*--)?pydis-forms\.netlify\.app)|forms\.pythondiscord\.com)" +HOSTS = r"https://(?:(?:(?:.*--)?pydis-forms\.netlify\.app)|forms\.pythondiscord\.com)" HAS_CUSTOM_HOST = os.getenv("ALLOWED_URL") is not None middleware = [ Middleware( CORSMiddleware, allow_origins=[os.getenv("ALLOWED_URL")] if HAS_CUSTOM_HOST else None, - allow_origin_regex=HOSTS_REGEX if not HAS_CUSTOM_HOST else None, + allow_origin_regex=HOSTS if not HAS_CUSTOM_HOST else None, allow_headers=[ "Authorization", "Content-Type" |