From 0abbf042ddb1dd1fd0ce2c33a3db1dd89364922b Mon Sep 17 00:00:00 2001 From: jakedt Date: Thu, 3 Apr 2014 18:47:17 -0400 Subject: [PATCH] Add a features modules that process the flask dict. --- app.py | 6 ++++++ config.py | 3 +++ features/__init__.py | 5 +++++ 3 files changed, 14 insertions(+) create mode 100644 features/__init__.py diff --git a/app.py b/app.py index 1b387f203..8ccdecf76 100644 --- a/app.py +++ b/app.py @@ -8,6 +8,8 @@ from flask.ext.principal import Principal from flask.ext.login import LoginManager from flask.ext.mail import Mail +import features + from storage import Storage from config import DefaultConfig 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)) app.config.from_object(overrides) +features.import_features(app.config) + +print "Billing: %s" % features.BILLING + Principal(app, use_sessions=False) login_manager = LoginManager() diff --git a/config.py b/config.py index 006ff2658..bf1790ba5 100644 --- a/config.py +++ b/config.py @@ -109,6 +109,9 @@ class DefaultConfig(object): STATUS_TAGS[tag_name] = tag_svg.read() + FEATURE_BILLING = False + + class FakeTransaction(object): def __enter__(self): return self diff --git a/features/__init__.py b/features/__init__.py new file mode 100644 index 000000000..b784a154e --- /dev/null +++ b/features/__init__.py @@ -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