Bug reading the config file. (#1857)

The config file had a bug where it expected both a "server" and "dataset" section.
If one didn't exist, then it would raise an exception.
It should use the default server config or the defaul dataset config in those cases.
Added a test case that would have caught this.
This commit is contained in:
bmccandless
2020-09-18 19:05:14 -07:00
committed by GitHub
parent 210042814f
commit a817a94eec
2 changed files with 45 additions and 2 deletions
+4 -2
View File
@@ -95,8 +95,10 @@ class AppConfig(object):
with open(config_file) as fyaml:
config = yaml.load(fyaml, Loader=yaml.FullLoader)
self.server_config.update_from_config(config["server"], "server")
self.default_dataset_config.update_from_config(config["dataset"], "dataset")
if config.get("server"):
self.server_config.update_from_config(config["server"], "server")
if config.get("dataset"):
self.default_dataset_config.update_from_config(config["dataset"], "dataset")
per_dataset_config = config.get("per_dataset_config", {})
for key, dataroot_config in per_dataset_config.items():