mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-07-19 08:53:17 +00:00
OpenHousing logs a job but silently drops the appointment when no bookable resource is sent, so the survey date never lands. log_job already sends the configured default_resource; amend_job omitted the parameter unless the request carried an explicit surveyor. Default amend's resource to the configured surveyor too, and fail loudly at config load on a blank ABRI_RELAY_DEFAULT_RESOURCE so the misconfiguration can't ship an empty resource again. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
26 lines
905 B
Python
26 lines
905 B
Python
from dataclasses import dataclass
|
|
from typing import Mapping
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class AbriConfig:
|
|
endpoint_url: str
|
|
username: str
|
|
password: str
|
|
default_resource: str
|
|
|
|
@classmethod
|
|
def from_env(cls, env: Mapping[str, str]) -> "AbriConfig":
|
|
# A blank default_resource does not error at the relay — OpenHousing
|
|
# logs the job but silently drops the appointment — so reject it here
|
|
# rather than let the misconfiguration ship an empty resource.
|
|
default_resource = env["ABRI_RELAY_DEFAULT_RESOURCE"]
|
|
if not default_resource.strip():
|
|
raise ValueError("ABRI_RELAY_DEFAULT_RESOURCE must not be blank")
|
|
|
|
return cls(
|
|
endpoint_url=env["ABRI_RELAY_URL"],
|
|
username=env["ABRI_RELAY_USERNAME"],
|
|
password=env["ABRI_RELAY_PASSWORD"],
|
|
default_resource=default_resource,
|
|
)
|