From 9578d46e006efed6b0ea465cd4a809214d45a3ac Mon Sep 17 00:00:00 2001 From: Aki Date: Wed, 5 Apr 2023 21:23:35 +0200 Subject: Simplified configuration file --- waterspout_radar/_config.py | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'waterspout_radar') diff --git a/waterspout_radar/_config.py b/waterspout_radar/_config.py index eaa6c58..7712939 100644 --- a/waterspout_radar/_config.py +++ b/waterspout_radar/_config.py @@ -8,18 +8,13 @@ Implements loading and providing the configuration of the radar instance. Usage An example configuration file looks like this: - [Storage] + [Waterspout Radar] db = .waterspout/db.json + key = [Locations] New York City Jersey City - - [Windy] - key = - - [Web] - port = 80 """ import configparser @@ -29,10 +24,9 @@ import typing @dataclasses.dataclass class Config: + db: str key: str locations: typing.List[str] - db: str - port: int class ConfigError(Exception): @@ -59,9 +53,8 @@ def load(pathname: str) -> Config: if required: errors.append(f"Config is missing required field: {pathname}: {section}: {name}") - _load_key("Storage", "db", default="radar.json") - _load_key("Windy", "key", required=True) - _load_key("Web", "port", type=int) + _load_key("Waterspout Radar", "db", default="radar.json") + _load_key("Waterspout Radar", "key", required=True) try: raw["locations"] = list(config["Locations"]) except KeyError: -- cgit v1.1