Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Introduce 'ENABLE_SSL' variable

Pacu2f4a2108f5479
diff --git a/saleor/core/utils/__init__.py b/saleor/core/utils/__init__.py
index d8a304da17..307ea28399 100644
--- a/saleor/core/utils/__init__.py
+++ b/saleor/core/utils/__init__.py
@@ -35,10 +35,10 @@ class CategoryChoiceField(forms.ModelChoiceField):
return '%s%s' % (indent, smart_text(obj))
-def build_absolute_uri(location, is_secure=settings.ENABLE_SSL):
+def build_absolute_uri(location):
# type: (str, bool, saleor.site.models.SiteSettings) -> str
host = Site.objects.get_current().domain
- current_uri = '%s://%s' % ('https' if is_secure else 'http', host)
+ current_uri = '%s://%s' % ('https' if settings.ENABLE_SSL else 'http', host)
location = urljoin(current_uri, location)
return iri_to_uri(location)
diff --git a/saleor/settings.py b/saleor/settings.py
index 8f8bd3fdbc..46005562ca 100644
--- a/saleor/settings.py
+++ b/saleor/settings.py
@@ -67,6 +67,9 @@ EMAIL_BACKEND = email_config['EMAIL_BACKEND']
EMAIL_USE_TLS = email_config['EMAIL_USE_TLS']
EMAIL_USE_SSL = email_config['EMAIL_USE_SSL']
+ENABLE_SSL = ast.literal_eval(
+ os.environ.get('ENABLE_SSL', 'False'))
+
DEFAULT_FROM_EMAIL = os.environ.get('DEFAULT_FROM_EMAIL')
ORDER_FROM_EMAIL = os.getenv('ORDER_FROM_EMAIL', DEFAULT_FROM_EMAIL)