29 lines
669 B
Python
29 lines
669 B
Python
from configparser import ConfigParser
|
|
from easydict import EasyDict as edict
|
|
|
|
|
|
CONFIG_FILE = 'config.ini'
|
|
|
|
|
|
class Configure:
|
|
|
|
def __init__(self):
|
|
config = ConfigParser()
|
|
config.read(CONFIG_FILE)
|
|
self.data = dict()
|
|
|
|
for section in config.sections():
|
|
self.data[section] = dict()
|
|
|
|
for key, value in config.items(section):
|
|
self.data[section][key] = value
|
|
|
|
|
|
|
|
def __getattr__(self, name):
|
|
for key in self.data.keys():
|
|
if name not in self.data[key]:
|
|
continue
|
|
return self.data[key][name]
|
|
raise NameError("Config options not found!")
|