Commit 5a01be9c by Matjaz Gregoric

Make is possible to configure the database via environment vars.

... and by extension via ansible vars from the edx/configuration
notifier role.
parent 1344fad4
...@@ -6,4 +6,4 @@ Sarina Canelake <sarina@edx.org> ...@@ -6,4 +6,4 @@ Sarina Canelake <sarina@edx.org>
Nimisha Asthagiri <nasthagiri@edx.org> Nimisha Asthagiri <nasthagiri@edx.org>
Christina Roberts <christina@edx.org> Christina Roberts <christina@edx.org>
Myles Fong <i@myles.hk> Myles Fong <i@myles.hk>
Matjaz Gregoric <matjaz@opencraft.com>
...@@ -5,12 +5,17 @@ import platform ...@@ -5,12 +5,17 @@ import platform
DATABASES = { DATABASES = {
'default': { 'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. # Database backend defaults to 'sqlite3', but 'mysql' is also supported.
'NAME': os.path.join(os.getenv('NOTIFIER_DB_DIR', '.'), 'notifier.db'), 'ENGINE': os.getenv('NOTIFIER_DATABASE_ENGINE', 'django.db.backends.sqlite3'),
'USER': '', # Not used with sqlite3. # Name should be set to database file path when using sqlite, and database name when using mysql.
'PASSWORD': '', # Not used with sqlite3. 'NAME': os.getenv('NOTIFIER_DATABASE_NAME', os.path.join(os.getenv('NOTIFIER_DB_DIR', '.'), 'notifier.db')),
'HOST': '', # Set to empty string for localhost. Not used with sqlite3. # User and password are not used by sqlite, but you will have to set them when using mysql.
'PORT': '', # Set to empty string for default. Not used with sqlite3. 'USER': os.getenv('NOTIFIER_DATABASE_USER', ''),
'PASSWORD': os.getenv('NOTIFIER_DATABASE_PASSWORD', ''),
# Host is not used by sqlite. Empty string means localhost when using mysql.
'HOST': os.getenv('NOTIFIER_DATABASE_HOST', ''),
# Port is not used by sqlite. Empty string means default port when using mysql.
'PORT': os.getenv('NOTIFIER_DATABASE_PORT', ''),
} }
} }
...@@ -203,4 +208,4 @@ LOCALE_PATHS = (os.path.join(os.path.dirname(os.path.dirname(__file__)), 'locale ...@@ -203,4 +208,4 @@ LOCALE_PATHS = (os.path.join(os.path.dirname(os.path.dirname(__file__)), 'locale
# Parameterize digest logo image url # Parameterize digest logo image url
LOGO_IMAGE_URL = os.getenv('LOGO_IMAGE_URL', "{}/static/images/edx-theme/edx-logo-77x36.png".format(LMS_URL_BASE)) LOGO_IMAGE_URL = os.getenv('LOGO_IMAGE_URL', "{}/static/images/edx-theme/edx-logo-77x36.png".format(LMS_URL_BASE))
DEAD_MANS_SNITCH_URL = os.getenv('DEAD_MANS_SNITCH_URL', '') DEAD_MANS_SNITCH_URL = os.getenv('DEAD_MANS_SNITCH_URL', '')
\ No newline at end of file
...@@ -15,6 +15,7 @@ kombu==3.0.37 ...@@ -15,6 +15,7 @@ kombu==3.0.37
logilab-astng==0.24.3 logilab-astng==0.24.3
logilab-common==1.1.0 logilab-common==1.1.0
mock==1.0.1 mock==1.0.1
MySQL-python==1.2.5
pep8==1.6.2 pep8==1.6.2
pylint==1.4.4 pylint==1.4.4
python-dateutil==2.4.2 python-dateutil==2.4.2
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment