Add get config value function

This commit is contained in:
Itay Mizeretz 2017-11-12 16:11:12 +02:00
parent be8d20b2f5
commit be8feeb3ee
1 changed files with 8 additions and 0 deletions

View File

@ -806,6 +806,14 @@ class ConfigService:
config.pop(field, None)
return config
@staticmethod
def get_config_value(config_key_as_arr):
config_key = reduce(lambda x, y: x+'.'+y, config_key_as_arr)
config = mongo.db.config.find_one({'name': 'newconfig'}, {config_key: 1})
for config_key_part in config_key_as_arr:
config = config[config_key_part]
return config
@staticmethod
def get_flat_config():
config_json = ConfigService.get_config()