Skip to content

Commit

Permalink
Fix setting false environment variables
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-gardener committed Feb 21, 2017
1 parent 6ca2494 commit 9a5a26a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
25 changes: 17 additions & 8 deletions compair/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import os

from distutils.util import strtobool
from flask import Config
from sqlalchemy.engine.url import URL

Expand Down Expand Up @@ -64,22 +65,30 @@
del config['DATABASE']

env_overridables = [
'APP_LOGIN_ENABLED', 'CAS_LOGIN_ENABLED', 'LTI_LOGIN_ENABLED',
'CAS_SERVER', 'CAS_AFTER_LOGIN', 'CAS_AFTER_LOGOUT',
'CAS_LOGIN_ROUTE', 'CAS_LOGOUT_ROUTE',
'CAS_LOGOUT_RETURN_URL',
'CAS_LOGIN_ROUTE', 'CAS_LOGOUT_ROUTE', 'CAS_LOGOUT_RETURN_URL',
'CAS_VALIDATE_ROUTE', 'CAS_ATTRIBUTES_TO_STORE',
'SECRET_KEY', 'REPORT_FOLDER', 'UPLOAD_FOLDER',
'ATTACHMENT_UPLOAD_FOLDER', 'ASSET_LOCATION', 'ASSET_CLOUD_URI_PREFIX',
'CELERY_ALWAYS_EAGER', 'CELERY_RESULT_BACKEND', 'CELERY_BROKER_URL',
'XAPI_ENABLED', 'XAPI_APP_BASE_URL',
'CELERY_RESULT_BACKEND', 'CELERY_BROKER_URL',
'XAPI_APP_BASE_URL',
'LRS_STATEMENT_ENDPOINT', 'LRS_AUTH', 'LRS_USERNAME', 'LRS_PASSWORD',
'LRS_ACTOR_ACCOUNT_USE_CAS',
'LRS_ACTOR_ACCOUNT_CAS_IDENTIFIER', 'LRS_ACTOR_ACCOUNT_CAS_HOMEPAGE',
'GA_TRACKING_ID', 'ENFORCE_SSL']
'GA_TRACKING_ID'
]

env_bool_overridables = [
'APP_LOGIN_ENABLED', 'CAS_LOGIN_ENABLED', 'LTI_LOGIN_ENABLED',
'CELERY_ALWAYS_EAGER', 'XAPI_ENABLED', 'LRS_ACTOR_ACCOUNT_USE_CAS',
'ENFORCE_SSL'
]

for env in env_overridables:
if os.environ.get(env):
if os.environ.get(env) != None:
config[env] = os.environ.get(env)

for env in env_bool_overridables:
if os.environ.get(env) != None:
config[env] = strtobool(os.environ.get(env))

# print config
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ services:
- DEV=1
- CELERY_BROKER_URL=redis://redis:6379
#- GA_TRACKING_ID=12345
- ENFORCE_SSL=0
volumes:
- .:/code
- ./.data/persistent:/code/persistent
Expand All @@ -51,6 +52,7 @@ services:
- DEV=1
- CELERY_BROKER_URL=redis://redis:6379
- C_FORCE_ROOT=1
- ENFORCE_SSL=0
web:
image: nginx:1.11
volumes:
Expand Down

0 comments on commit 9a5a26a

Please sign in to comment.