Add config override to allow for specialization using environment variables.
This commit is contained in:
parent
03b78414de
commit
2e923c0441
1 changed files with 5 additions and 0 deletions
5
app.py
5
app.py
|
@ -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))
|
||||
|
||||
|
|
Reference in a new issue