summaryrefslogtreecommitdiff
path: root/waterspout_radar/_config.py
diff options
context:
space:
mode:
Diffstat (limited to 'waterspout_radar/_config.py')
-rw-r--r--waterspout_radar/_config.py17
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: