Skip to content

Commit

Permalink
feat: expose more CORS related configurations via environment variables
Browse files Browse the repository at this point in the history
With the current django configurations exposed, it was not possible to
deploy and use caluma in a CORS scenario.  With this change more CORS
header configurations are exposed via environment variables. Furthermore
it enhances the django default values with some caluma required stuff
like the language header.
  • Loading branch information
SaschaPWittwer authored and anehx committed Nov 4, 2021
1 parent ae8f531 commit d88165c
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions caluma/settings/django.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,24 @@ def parse_admins(admins): # pragma: no cover
# Cors headers
CORS_ORIGIN_ALLOW_ALL = env.bool("CORS_ORIGIN_ALLOW_ALL", default=False)
CORS_ORIGIN_WHITELIST = env.list("CORS_ORIGIN_WHITELIST", default=[])
CORS_ALLOW_CREDENTIALS = env.bool("CORS_ALLOW_CREDENTIALS", default=True)
CORS_ALLOW_HEADERS = env.list(
"CORS_ALLOW_HEADERS",
default=[
"accept",
"accept-encoding",
"accept-language", # Custom added default value since ember-caluma uses it
"authorization",
"content-type",
"dnt",
"origin",
"user-agent",
"language", # Custom added default value since ember-caluma uses it
"x-csrftoken",
"x-requested-with",
],
)
CORS_ALLOW_METHODS = env.list("CORS_ALLOW_METHODS", default=["OPTIONS", "GET", "POST"])


# Logging
Expand Down

0 comments on commit d88165c

Please sign in to comment.