Add config override to allow for specialization using environment variables.

This commit is contained in:
Jake Moshenko 2014-06-23 11:24:54 -04:00
parent 03b78414de
commit 2e923c0441

5
app.py
View file

@ -1,5 +1,6 @@
import logging
import os
import json
from flask import Flask
from flask.ext.principal import Principal
@ -26,6 +27,7 @@ from datetime import datetime
OVERRIDE_CONFIG_FILENAME = 'conf/stack/config.py'
OVERRIDE_CONFIG_KEY = 'QUAY_OVERRIDE_CONFIG'
LICENSE_FILENAME = 'conf/stack/license.enc'
@ -46,6 +48,9 @@ else:
logger.debug('Applying config file: %s', OVERRIDE_CONFIG_FILENAME)
app.config.from_pyfile(OVERRIDE_CONFIG_FILENAME)
environ_config = json.loads(os.environ.get(OVERRIDE_CONFIG_KEY, '{}'))
app.config.update(environ_config)
logger.debug('Applying license config from: %s', LICENSE_FILENAME)
app.config.update(load_license(LICENSE_FILENAME))