Make settings more flexible with env variables
This commit is contained in:
		
							parent
							
								
									c2a7957095
								
							
						
					
					
						commit
						5cc69b0998
					
				@ -9,6 +9,7 @@ stringData:
 | 
				
			|||||||
    ALLOWED_HOSTS: "*" # For better security, set this to your deployment's domain. Comma separated.
 | 
					    ALLOWED_HOSTS: "*" # For better security, set this to your deployment's domain. Comma separated.
 | 
				
			||||||
    DJANGO_SECRET_KEY: ""
 | 
					    DJANGO_SECRET_KEY: ""
 | 
				
			||||||
    SIGNUPS_ENABLED: "False"
 | 
					    SIGNUPS_ENABLED: "False"
 | 
				
			||||||
 | 
					    TIME_ZONE: "America/New_York"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Redis configuration (if you use the default Kubernetes config, this will work)
 | 
					    # Redis configuration (if you use the default Kubernetes config, this will work)
 | 
				
			||||||
    REDIS_CACHE_LOCATION: "redis://redis.default.svc.cluster.local/0"
 | 
					    REDIS_CACHE_LOCATION: "redis://redis.default.svc.cluster.local/0"
 | 
				
			||||||
 | 
				
			|||||||
@ -23,7 +23,7 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
 | 
				
			|||||||
# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
 | 
					# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# SECURITY WARNING: keep the secret key used in production secret!
 | 
					# SECURITY WARNING: keep the secret key used in production secret!
 | 
				
			||||||
SECRET_KEY = "q@@928+gjkhmcdpuwse0awn@#ygm#0etg11jlny+b*^cm5m-x!"
 | 
					SECRET_KEY = os.getenv("DJANGO_SECRET_KEY", "onlyusethisindev")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# SECURITY WARNING: don't run with debug turned on in production!
 | 
					# SECURITY WARNING: don't run with debug turned on in production!
 | 
				
			||||||
DEBUG = os.getenv("DEBUG", "True") == "True"
 | 
					DEBUG = os.getenv("DEBUG", "True") == "True"
 | 
				
			||||||
@ -161,7 +161,7 @@ LOGGING = {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
LANGUAGE_CODE = "en-us"
 | 
					LANGUAGE_CODE = "en-us"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TIME_ZONE = "America/New_York"
 | 
					TIME_ZONE = os.getenv("TIME_ZONE", "America/New_York")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
USE_I18N = True
 | 
					USE_I18N = True
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -236,7 +236,7 @@ MESSAGE_TAGS = {
 | 
				
			|||||||
SERVER_EMAIL = os.getenv("SERVER_EMAIL", "Shynet <noreply@shynet.example.com>")
 | 
					SERVER_EMAIL = os.getenv("SERVER_EMAIL", "Shynet <noreply@shynet.example.com>")
 | 
				
			||||||
DEFAULT_FROM_EMAIL = SERVER_EMAIL
 | 
					DEFAULT_FROM_EMAIL = SERVER_EMAIL
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if DEBUG:
 | 
					if DEBUG or os.environ.get("EMAIL_HOST") is None:
 | 
				
			||||||
    EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
 | 
					    EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
 | 
				
			||||||
else:
 | 
					else:
 | 
				
			||||||
    EMAIL_HOST = os.environ.get("EMAIL_HOST")
 | 
					    EMAIL_HOST = os.environ.get("EMAIL_HOST")
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user