first commit

This commit is contained in:
Joakim Svensson
2026-04-26 17:20:58 +02:00
commit 42ba6feed4
13 changed files with 865 additions and 0 deletions

32
collector/config.py Normal file
View File

@@ -0,0 +1,32 @@
import os
from dataclasses import dataclass
@dataclass
class Config:
db_url: str
api_key: str
station_call: str
aprs_is_host: str
aprs_is_port: int
aprs_is_callsign: str
aprs_is_passcode: str
aprs_is_filter: str
log_level: str
@classmethod
def from_env(cls) -> "Config":
api_key = os.environ.get("API_KEY", "")
if not api_key:
raise RuntimeError("API_KEY environment variable is required")
return cls(
db_url=os.getenv("DATABASE_URL", "postgresql://aprs:aprs@db:5432/aprs"),
api_key=api_key,
station_call=os.getenv("STATION_CALL", "SA6ANW-1"),
aprs_is_host=os.getenv("APRS_IS_HOST", "rotate.aprs2.net"),
aprs_is_port=int(os.getenv("APRS_IS_PORT", "14580")),
aprs_is_callsign=os.getenv("APRS_IS_CALLSIGN", "SA6ANW-1"),
aprs_is_passcode=os.getenv("APRS_IS_PASSCODE", "-1"),
aprs_is_filter=os.getenv("APRS_IS_FILTER", "r/58.35/14.05/200"),
log_level=os.getenv("LOG_LEVEL", "INFO"),
)