Skip to content

Commit

Permalink
refactor: values to consider for ALLOWED_HOSTS
Browse files Browse the repository at this point in the history
  • Loading branch information
koeaw committed Dec 4, 2023
1 parent 4e03ef1 commit 4d18061
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions apis_ontology/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,11 @@
"frischmuth-dev.acdh-dev.oeaw.ac.at",
]

if "ALLOWED_HOSTS" in os.environ:
try:
ALLOWED_HOSTS = re.sub(r"https?://", "", os.environ.get("ALLOWED_HOSTS")).split(
","
)
except Exception as e:
print(e)
print(
"Invalid environment variable value for ALLOWED_HOSTS.\n"
"Falling back to default ALLOWED_HOSTS defined in settings."
)
ALLOWED_HOSTS = re.sub(
r"https?://",
"",
os.environ.get("ALLOWED_HOSTS", ",".join(ALLOWED_HOSTS)),
).split(",")

# Application definition

Expand Down

0 comments on commit 4d18061

Please sign in to comment.