1 """Global Configuration."""
5 from osm_policy_module
.core
.singleton
import Singleton
8 from configparser
import ConfigParser
10 from ConfigParser
import ConfigParser
12 log
= logging
.getLogger(__name__
)
17 """Global configuration."""
20 # Default config values
23 'kafka_server_host': '127.0.0.1',
24 'kafka_server_port': '9092',
30 def load_file(self
, config_file_path
):
32 config_parser
= ConfigParser()
33 config_parser
.read(config_file_path
)
34 for section
in config_parser
.sections():
35 for key
, value
in config_parser
.items(section
):
36 if section
not in self
.config
:
37 self
.config
[section
] = {}
38 self
.config
[section
][key
] = value
40 def get(self
, group
, name
=None, default
=None):
41 if group
in self
.config
:
43 return self
.config
[group
]
44 return self
.config
[group
].get(name
, default
)