diff options
author | Aki <please@ignore.pl> | 2023-04-05 21:23:35 +0200 |
---|---|---|
committer | Aki <please@ignore.pl> | 2023-04-05 21:23:35 +0200 |
commit | 9578d46e006efed6b0ea465cd4a809214d45a3ac (patch) | |
tree | 0e3370b51521962686c0668e18e807b7bca28c9d /waterspout_radar | |
parent | dca92b16a5adbfea7496d36ced00bf4eb503de20 (diff) | |
download | waterspout-radar-9578d46e006efed6b0ea465cd4a809214d45a3ac.zip waterspout-radar-9578d46e006efed6b0ea465cd4a809214d45a3ac.tar.gz waterspout-radar-9578d46e006efed6b0ea465cd4a809214d45a3ac.tar.bz2 |
Simplified configuration file
Diffstat (limited to 'waterspout_radar')
-rw-r--r-- | waterspout_radar/_config.py | 17 |
1 files changed, 5 insertions, 12 deletions
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 = <secret key> [Locations] New York City Jersey City - - [Windy] - key = <secret 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: |