From e6c9db2ff3cf899cc67e660d2926f9115edc57ff Mon Sep 17 00:00:00 2001 From: Philipp Fruck Date: Thu, 16 Feb 2023 23:53:28 +0000 Subject: [PATCH] configure cors and allowed hosts using env vars (#4355) --- InvenTree/InvenTree/settings.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/InvenTree/InvenTree/settings.py b/InvenTree/InvenTree/settings.py index 68174f019a..6be6b6f6d2 100644 --- a/InvenTree/InvenTree/settings.py +++ b/InvenTree/InvenTree/settings.py @@ -102,6 +102,7 @@ MEDIA_ROOT = config.get_media_dir() # List of allowed hosts (default = allow all) ALLOWED_HOSTS = get_setting( + "INVENTREE_ALLOWED_HOSTS", config_key='allowed_hosts', default_value=['*'], typecast=list, @@ -114,11 +115,13 @@ CORS_URLS_REGEX = r'^/api/.*$' # Extract CORS options from configuration file CORS_ORIGIN_ALLOW_ALL = get_boolean_setting( + "INVENTREE_CORS_ORIGIN_ALLOW_ALL", config_key='cors.allow_all', default_value=False, ) CORS_ORIGIN_WHITELIST = get_setting( + "INVENTREE_CORS_ORIGIN_WHITELIST", config_key='cors.whitelist', default_value=[], typecast=list,