store logging path in Config class
This commit is contained in:
@@ -162,12 +162,13 @@ class Config():
|
|||||||
)
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def init(cls, def_reader: ConfigIfc) -> None | str:
|
def init(cls, def_reader: ConfigIfc, log_path: str = '') -> None | str:
|
||||||
'''Initialise the Proxy-Config
|
'''Initialise the Proxy-Config
|
||||||
|
|
||||||
Copy the internal default config file into the config directory
|
Copy the internal default config file into the config directory
|
||||||
and initialise the Config with the default configuration '''
|
and initialise the Config with the default configuration '''
|
||||||
cls.err = None
|
cls.err = None
|
||||||
|
cls.log_path = log_path
|
||||||
cls.def_config = {}
|
cls.def_config = {}
|
||||||
try:
|
try:
|
||||||
# make the default config transparaent by copying it
|
# make the default config transparaent by copying it
|
||||||
@@ -247,3 +248,7 @@ here. The default config reader is handled in the Config.init method'''
|
|||||||
'''Check if the member is the default value'''
|
'''Check if the member is the default value'''
|
||||||
|
|
||||||
return cls.act_config.get(member) == cls.def_config.get(member)
|
return cls.act_config.get(member) == cls.def_config.get(member)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_log_path(cls) -> str:
|
||||||
|
return cls.log_path
|
||||||
|
|||||||
@@ -179,7 +179,8 @@ def main(): # pragma: no cover
|
|||||||
asyncio.set_event_loop(loop)
|
asyncio.set_event_loop(loop)
|
||||||
|
|
||||||
# read config file
|
# read config file
|
||||||
Config.init(ConfigReadToml(src_dir + "cnf/default_config.toml"))
|
Config.init(ConfigReadToml(src_dir + "cnf/default_config.toml"),
|
||||||
|
log_path=args.log_path)
|
||||||
ConfigReadEnv()
|
ConfigReadEnv()
|
||||||
ConfigReadJson(args.config_path + "config.json")
|
ConfigReadJson(args.config_path + "config.json")
|
||||||
ConfigReadToml(args.config_path + "config.toml")
|
ConfigReadToml(args.config_path + "config.toml")
|
||||||
|
|||||||
Reference in New Issue
Block a user