config : take cache_dir_path into account
cache_dir_path and all of the OtherConfig was ignored and the default value was loaded, read its value from the config file instead.
This commit is contained in:
@@ -79,6 +79,7 @@ def load_config(config_path:str) -> Config:
|
|||||||
# Check if sections are provided
|
# Check if sections are provided
|
||||||
server_section = "Server" if "Server" in config.sections() else UNNAMED_SECTION
|
server_section = "Server" if "Server" in config.sections() else UNNAMED_SECTION
|
||||||
roots_section = "Roots" if "Roots" in config.sections() else UNNAMED_SECTION
|
roots_section = "Roots" if "Roots" in config.sections() else UNNAMED_SECTION
|
||||||
|
other_section = "Other" if "Other" in config.sections() else UNNAMED_SECTION
|
||||||
|
|
||||||
server_config = ServerConfig(
|
server_config = ServerConfig(
|
||||||
config.get(server_section, "user"),
|
config.get(server_section, "user"),
|
||||||
@@ -91,6 +92,9 @@ def load_config(config_path:str) -> Config:
|
|||||||
config.get(roots_section, "local"),
|
config.get(roots_section, "local"),
|
||||||
config.get(roots_section, "remote")
|
config.get(roots_section, "remote")
|
||||||
)
|
)
|
||||||
|
other_config = OtherConfig(
|
||||||
|
config.get(other_section, "cache_dir_path", fallback=DEFAULT_MISC_CACHE_DIR_PATH)
|
||||||
|
)
|
||||||
|
|
||||||
args_bool = list()
|
args_bool = list()
|
||||||
args_val = dict()
|
args_val = dict()
|
||||||
@@ -104,4 +108,4 @@ def load_config(config_path:str) -> Config:
|
|||||||
args_val[key] = val
|
args_val[key] = val
|
||||||
unison_config = UnisonConfig(args_bool, args_val)
|
unison_config = UnisonConfig(args_bool, args_val)
|
||||||
|
|
||||||
return Config(server_config, roots_config, unison_config)
|
return Config(server_config, roots_config, unison_config, other_config)
|
||||||
|
|||||||
Reference in New Issue
Block a user