Skip to content

Commit

Permalink
check that healthchecks url is a string and make log message more gen…
Browse files Browse the repository at this point in the history
…eric
  • Loading branch information
StevenMassaro committed Jan 24, 2024
1 parent 8446e7e commit 5cd45af
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@ def _parse_config(self, config: JSON) -> None:
if not isinstance(self.check_fares, bool):
raise ConfigError("'check_fares' must be a boolean")

if "healthchecks_url" in config:
self.healthchecks_url = config["healthchecks_url"]

if not isinstance(self.healthchecks_url, str):
raise ConfigError("'healthchecks_url' must be a string")

logger.debug("A Healthchecks URL has been provided")

if "notification_level" in config:
notification_level = config["notification_level"]
try:
Expand Down Expand Up @@ -97,10 +105,6 @@ def _parse_config(self, config: JSON) -> None:
# Convert hours to seconds
self.retrieval_interval *= 3600

if "healthchecks_url" in config:
self.healthchecks_url = config["healthchecks_url"]
logger.debug("Setting healthchecks URL to %s", self.healthchecks_url)


class GlobalConfig(Config):
def __init__(self) -> None:
Expand Down

0 comments on commit 5cd45af

Please sign in to comment.