Skip to content
Snippets Groups Projects
Commit 95ae2bf7 authored by Sebastian Lobinger's avatar Sebastian Lobinger
Browse files

implement ability for multiple configs in ConfigProvider fix issue #8

parent d9156e71
No related branches found
No related tags found
1 merge request!4Resolve "verschiedene Konfigurationen innerhalb einer Anwednung ermöglichen"
class ConfigProvider:
_instance = None
_configs = {}
@classmethod
def getInstance(cls):
return ConfigProvider._instance
def getInstance(cls, name = None):
if name is None:
return ConfigProvider._instance
else:
return ConfigProvider._configs.get(name)
def __init__(self, load_function):
def __init__(self, load_function, name = None):
self._conf_dict = load_function['function'](
*load_function.get('args'), **load_function.get('kwargs'))
*load_function.get('args', []), **load_function.get('kwargs',{}))
self._load_function = load_function
ConfigProvider._instance = self
if name is None:
ConfigProvider._instance = self
else:
ConfigProvider._configs[name] = self
@property
def dict(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment