Add a features modules that process the flask dict.
This commit is contained in:
parent
173f8d9b9a
commit
0abbf042dd
3 changed files with 14 additions and 0 deletions
6
app.py
6
app.py
|
@ -8,6 +8,8 @@ from flask.ext.principal import Principal
|
||||||
from flask.ext.login import LoginManager
|
from flask.ext.login import LoginManager
|
||||||
from flask.ext.mail import Mail
|
from flask.ext.mail import Mail
|
||||||
|
|
||||||
|
import features
|
||||||
|
|
||||||
from storage import Storage
|
from storage import Storage
|
||||||
from config import DefaultConfig
|
from config import DefaultConfig
|
||||||
from data.userfiles import Userfiles
|
from data.userfiles import Userfiles
|
||||||
|
@ -28,6 +30,10 @@ overrides = json.loads(os.environ.get('QUAY_CONFIG', '{}'))
|
||||||
logger.debug('Applying %s config overrides.', len(overrides))
|
logger.debug('Applying %s config overrides.', len(overrides))
|
||||||
app.config.from_object(overrides)
|
app.config.from_object(overrides)
|
||||||
|
|
||||||
|
features.import_features(app.config)
|
||||||
|
|
||||||
|
print "Billing: %s" % features.BILLING
|
||||||
|
|
||||||
Principal(app, use_sessions=False)
|
Principal(app, use_sessions=False)
|
||||||
|
|
||||||
login_manager = LoginManager()
|
login_manager = LoginManager()
|
||||||
|
|
|
@ -109,6 +109,9 @@ class DefaultConfig(object):
|
||||||
STATUS_TAGS[tag_name] = tag_svg.read()
|
STATUS_TAGS[tag_name] = tag_svg.read()
|
||||||
|
|
||||||
|
|
||||||
|
FEATURE_BILLING = False
|
||||||
|
|
||||||
|
|
||||||
class FakeTransaction(object):
|
class FakeTransaction(object):
|
||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
return self
|
return self
|
||||||
|
|
5
features/__init__.py
Normal file
5
features/__init__.py
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
def import_features(config_dict):
|
||||||
|
for feature, feature_val in config_dict.items():
|
||||||
|
if feature.startswith('FEATURE_'):
|
||||||
|
feature_name = feature[8:]
|
||||||
|
globals()[feature_name] = feature_val
|
Reference in a new issue