2021-12-12 00:42:00 +01:00
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
from dataclasses import dataclass
|
|
|
|
from typing import List
|
|
|
|
|
|
|
|
|
|
|
|
@dataclass
|
|
|
|
class SiteDescription:
|
|
|
|
name: str
|
|
|
|
baseurl: str
|
|
|
|
|
|
|
|
|
|
|
|
def parse_site_list(raw_site_list: str) -> List[SiteDescription]:
|
|
|
|
parsed_sites = []
|
|
|
|
for pair in raw_site_list.split(' '):
|
|
|
|
name, baseurl = pair.split(';', 1)
|
|
|
|
parsed_sites.append(
|
|
|
|
SiteDescription(
|
|
|
|
name=name,
|
|
|
|
baseurl=baseurl
|
|
|
|
)
|
|
|
|
)
|
|
|
|
return parsed_sites
|
|
|
|
|
|
|
|
|
|
|
|
class Config:
|
|
|
|
INTERVAL = int(os.environ.get("INTERVAL", 30))
|
2021-12-12 02:07:26 +01:00
|
|
|
SITE_LIST = parse_site_list(os.environ.get("SITES")) # This is in priority order
|
2021-12-12 00:42:00 +01:00
|
|
|
|
|
|
|
SENTRY_DSN = os.environ.get("SENTRY_DSN")
|
|
|
|
|
|
|
|
RELEASE_ID = os.environ.get("RELEASE_ID", "test")
|
|
|
|
RELEASEMODE = os.environ.get("RELEASEMODE", "dev")
|
|
|
|
DEBUG = ('--debug' in sys.argv) or bool(os.environ.get("DEBUG", "").upper() in ['YES', 'TRUE', '1'])
|
2021-12-12 02:07:26 +01:00
|
|
|
|
|
|
|
REDIS_URL = os.environ["REDIS_URL"]
|
|
|
|
COLLECTOR_URL = os.environ["COLLECTOR_URL"] # http://example.com/report/
|