mirror of
https://github.com/quay/quay.git
synced 2025-04-18 10:44:06 +03:00
Currently the prometheus and GC workers are not running correctly. Reverting the following commits: -4e1a985e70
-dac183a1ef
-68a0d9eaf0
-af1aacea08
-f334b80098
36 lines
885 B
Python
36 lines
885 B
Python
_FEATURES = {}
|
|
|
|
|
|
def import_features(config_dict):
|
|
for feature, feature_val in list(config_dict.items()):
|
|
if feature.startswith("FEATURE_"):
|
|
feature_name = feature[8:]
|
|
_FEATURES[feature_name] = globals()[feature_name] = FeatureNameValue(
|
|
feature_name, feature_val
|
|
)
|
|
|
|
|
|
def get_features():
|
|
return {key: _FEATURES[key].value for key in _FEATURES}
|
|
|
|
|
|
class FeatureNameValue(object):
|
|
def __init__(self, name, value):
|
|
self.value = value
|
|
self.name = name
|
|
|
|
def __str__(self):
|
|
return "%s => %s" % (self.name, self.value)
|
|
|
|
def __repr__(self):
|
|
return str(self.value)
|
|
|
|
def __cmp__(self, other):
|
|
return self.value.__cmp__(other)
|
|
|
|
def __bool__(self):
|
|
if isinstance(self.value, str):
|
|
return self.value.lower() == "true"
|
|
|
|
return bool(self.value)
|