aboutsummaryrefslogtreecommitdiffstats
path: root/src/laas_dashboard
diff options
context:
space:
mode:
authorSawyer Bergeron <sbergeron@iol.unh.edu>2021-10-15 17:03:58 -0400
committerSawyer Bergeron <sbergeron@iol.unh.edu>2021-10-28 15:32:26 -0400
commit104470ee008817df4a3b78d24e524e8c92eac9a0 (patch)
treea4a6b70043f34c37b568bbe6a4b6e72d8c619716 /src/laas_dashboard
parentafcee3cad5c091e78e909b83f8df49accf1af5b6 (diff)
WIP merge of master into cobblercobbler
Squashed commit of the following: commit 35b9f39178cc502a5283a1b37a65f7dd0838ae05 Author: Sawyer Bergeron <sbergeron@iol.unh.edu> Date: Fri Oct 15 14:14:46 2021 -0400 Merge User Booking API Rev 1 (Try 3) Signed-off-by: Sawyer Bergeron <sbergeron@iol.unh.edu> Change-Id: Ie1eee0a59929f8da39f16bb6bc17ae3de4f1cba9 Signed-off-by: Sawyer Bergeron <sbergeron@iol.unh.edu> commit b3ed8ebcf536c021330e7ccbc0376f6b89189348 Author: Jacob Hodgdon <jhodgdon@iol.unh.edu> Date: Tue Jul 20 09:55:04 2021 -0400 Additional changes for rebrand Signed-off-by: Jacob Hodgdon <jhodgdon@iol.unh.edu> Change-Id: Ibd525f966b3ed3aebdbe688e5ee5daa4ea1cf294 Signed-off-by: Jacob Hodgdon <jhodgdon@iol.unh.edu> Signed-off-by: Raven Hodgdon <jhodgdon@iol.unh.edu> commit 17b6c7809771ac8bf3879add033d2169f671591a Author: Jacob Hodgdon <jhodgdon@iol.unh.edu> Date: Fri May 14 15:42:56 2021 -0400 Color fixes for rebrand Signed-off-by: Jacob Hodgdon <jhodgdon@iol.unh.edu> Change-Id: I5cf4ede598afa377db7ecec17d8dfef085e130ac Change-Id: I55494d24bcef74def85236b09168508e428d368e Signed-off-by: Sawyer Bergeron <sbergeron@iol.unh.edu>
Diffstat (limited to 'src/laas_dashboard')
-rw-r--r--src/laas_dashboard/settings.py75
1 files changed, 35 insertions, 40 deletions
diff --git a/src/laas_dashboard/settings.py b/src/laas_dashboard/settings.py
index 6b3ed09..f253fa0 100644
--- a/src/laas_dashboard/settings.py
+++ b/src/laas_dashboard/settings.py
@@ -15,8 +15,8 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# SECURITY WARNING: don't run with debug turned on in production!
# NOTE: os.environ only returns strings, so making a comparison to
# 'True' here will convert it to the correct Boolean value.
-DEBUG = os.environ['DEBUG'] == 'True'
-TESTING = os.environ['TEST'] == 'True'
+DEBUG = os.environ.get('DEBUG') == 'True'
+TESTING = os.environ.get('TEST') == 'True'
# Application definition
@@ -53,29 +53,34 @@ MIDDLEWARE = [
'account.middleware.TimezoneMiddleware',
]
-AUTH_SETTING = os.environ.get('AUTH_SETTING', 'JIRA')
-if AUTH_SETTING == 'LFID':
- AUTHENTICATION_BACKENDS = ['account.views.MyOIDCAB']
+# AUTHENTICATION_BACKENDS = ['django.contrib.auth.backends.ModelBackend', 'account.views.MyOIDCAB']
+AUTHENTICATION_BACKENDS = ['django.contrib.auth.backends.ModelBackend']
+
+AUTH_SETTING = os.environ.get('AUTH_SETTING')
+if AUTH_SETTING == 'LFID':
# OpenID Authentications
- OIDC_RP_CLIENT_ID = os.environ['OIDC_CLIENT_ID']
- OIDC_RP_CLIENT_SECRET = os.environ['OIDC_CLIENT_SECRET']
+ AUTHENTICATION_BACKENDS.append('account.views.MyOIDCAB')
+ OIDC_RP_CLIENT_ID = os.environ.get('OIDC_CLIENT_ID')
+ OIDC_RP_CLIENT_SECRET = os.environ.get('OIDC_CLIENT_SECRET')
- OIDC_OP_AUTHORIZATION_ENDPOINT = os.environ['OIDC_AUTHORIZATION_ENDPOINT']
- OIDC_OP_TOKEN_ENDPOINT = os.environ['OIDC_TOKEN_ENDPOINT']
- OIDC_OP_USER_ENDPOINT = os.environ['OIDC_USER_ENDPOINT']
+ OIDC_OP_AUTHORIZATION_ENDPOINT = os.environ.get('OIDC_AUTHORIZATION_ENDPOINT')
+ OIDC_OP_TOKEN_ENDPOINT = os.environ.get('OIDC_TOKEN_ENDPOINT')
+ OIDC_OP_USER_ENDPOINT = os.environ.get('OIDC_USER_ENDPOINT')
- LOGIN_REDIRECT_URL = os.environ['DASHBOARD_URL']
- LOGOUT_REDIRECT_URL = os.environ['DASHBOARD_URL']
+ LOGIN_REDIRECT_URL = os.environ.get('DASHBOARD_URL')
+ LOGOUT_REDIRECT_URL = os.environ.get('DASHBOARD_URL')
- OIDC_RP_SIGN_ALGO = os.environ["OIDC_RP_SIGN_ALGO"]
+ OIDC_RP_SIGN_ALGO = os.environ.get("OIDC_RP_SIGN_ALGO")
if OIDC_RP_SIGN_ALGO == "RS256":
- OIDC_OP_JWKS_ENDPOINT = os.environ["OIDC_OP_JWKS_ENDPOINT"]
+ OIDC_OP_JWKS_ENDPOINT = os.environ.get("OIDC_OP_JWKS_ENDPOINT")
+else:
+ raise Exception('AUTH_SETTING set to invalid value')
# This is for LFID auth setups w/ an HTTPS proxy
-if os.environ['EXPECT_HOST_FORWARDING'] == 'True':
+if os.environ.get('EXPECT_HOST_FORWARDING') == 'True':
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', "https")
USE_X_FORWARDED_HOST = True
@@ -162,7 +167,7 @@ STATICFILES_DIRS = [
LOGIN_REDIRECT_URL = '/'
# SECURITY WARNING: keep the secret key used in production secret!
-SECRET_KEY = os.environ['SECRET_KEY']
+SECRET_KEY = os.environ.get('SECRET_KEY')
BOOTSTRAP3 = {
'set_placeholder': False,
@@ -175,11 +180,11 @@ ALLOWED_HOSTS = ['*']
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
- 'NAME': os.environ['DB_NAME'],
- 'USER': os.environ['DB_USER'],
- 'PASSWORD': os.environ['DB_PASS'],
- 'HOST': os.environ['DB_SERVICE'],
- 'PORT': os.environ['DB_PORT']
+ 'NAME': os.environ.get('DB_NAME'),
+ 'USER': os.environ.get('DB_USER'),
+ 'PASSWORD': os.environ.get('DB_PASS'),
+ 'HOST': os.environ.get('DB_SERVICE'),
+ 'PORT': os.environ.get('DB_PORT')
}
}
@@ -198,27 +203,17 @@ REST_FRAMEWORK = {
MEDIA_ROOT = '/media'
STATIC_ROOT = '/static'
-# Jira Settings
-CREATE_JIRA_TICKET = False
-
-JIRA_URL = os.environ['JIRA_URL']
-
-JIRA_USER_NAME = os.environ['JIRA_USER_NAME']
-JIRA_USER_PASSWORD = os.environ['JIRA_USER_PASSWORD']
-
-OAUTH_CONSUMER_KEY = os.environ['OAUTH_CONSUMER_KEY']
-OAUTH_CONSUMER_SECRET = os.environ['OAUTH_CONSUMER_SECRET']
-
-OAUTH_REQUEST_TOKEN_URL = JIRA_URL + '/plugins/servlet/oauth/request-token'
-OAUTH_ACCESS_TOKEN_URL = JIRA_URL + '/plugins/servlet/oauth/access-token'
-OAUTH_AUTHORIZE_URL = JIRA_URL + '/plugins/servlet/oauth/authorize'
+OAUTH_CONSUMER_KEY = os.environ.get('OAUTH_CONSUMER_KEY')
+OAUTH_CONSUMER_SECRET = os.environ.get('OAUTH_CONSUMER_SECRET')
-OAUTH_CALLBACK_URL = os.environ['DASHBOARD_URL'] + '/accounts/authenticated'
+OAUTH_CALLBACK_URL = os.environ.get('DASHBOARD_URL') + '/accounts/authenticated'
# Celery Settings
CELERY_TIMEZONE = 'UTC'
RABBITMQ_URL = 'rabbitmq'
+# RABBITMQ_DEFAULT_USER = os.environ['DEFAULT_USER']
+# RABBITMQ_DEFAULT_PASS = os.environ['DEFAULT_PASS']
RABBITMQ_DEFAULT_USER = os.environ['RABBITMQ_DEFAULT_USER']
RABBITMQ_DEFAULT_PASS = os.environ['RABBITMQ_DEFAULT_PASS']
@@ -248,10 +243,10 @@ CELERYBEAT_SCHEDULE = {
}
# Notifier Settings
-EMAIL_HOST = os.environ['EMAIL_HOST']
-EMAIL_PORT = os.environ['EMAIL_PORT']
-EMAIL_HOST_USER = os.environ['EMAIL_HOST_USER']
-EMAIL_HOST_PASSWORD = os.environ['EMAIL_HOST_PASSWORD']
+EMAIL_HOST = os.environ.get('EMAIL_HOST')
+EMAIL_PORT = os.environ.get('EMAIL_PORT')
+EMAIL_HOST_USER = os.environ.get('EMAIL_HOST_USER')
+EMAIL_HOST_PASSWORD = os.environ.get('EMAIL_HOST_PASSWORD')
EMAIL_USE_TLS = True
DEFAULT_EMAIL_FROM = os.environ.get('DEFAULT_EMAIL_FROM', 'webmaster@localhost')
SESSION_ENGINE = "django.contrib.sessions.backends.signed_cookies"