Listen to all hosts if BINALL env var is set

This commit is contained in:
Tanner Collin 2022-04-06 22:04:56 +00:00
parent e02045c9ac
commit 3aea713a1b

View File

@ -29,6 +29,7 @@ SECRET_KEY = secrets.DJANGO_SECRET_KEY or 'OaOBN2E+brpoRyDMlTD9eTE5PgBtkkl+L7Bzt
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG_ENV = os.environ.get('DEBUG', False)
BINDALL_ENV = os.environ.get('BINDALL', False)
DEBUG = DEBUG_ENV or False
@ -44,12 +45,13 @@ if DEBUG:
ALLOWED_HOSTS += [
'localhost',
'127.0.0.1',
'spaceport-api.dns.t0.vc',
'api.spaceport.dns.t0.vc',
'api.my.dns.t0.vc',
'api.my.protospace.ca',
]
if BINDALL_ENV:
ALLOWED_HOSTS = ['*']
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
SESSION_COOKIE_SECURE = True
CSRF_COOKIE_SECURE = True