Финальная стабильная реализация
This commit is contained in:
@@ -46,6 +46,7 @@ class Settings(BaseSettings):
|
||||
contact_user_id_field: str | None = None
|
||||
contact_registered_field: str | None = None
|
||||
contact_citizenship_field: str | None = None
|
||||
contact_source: str | None = Field(default=None, min_length=1, max_length=128)
|
||||
webhook_allowed_cidrs: str = ""
|
||||
|
||||
http_timeout_sec: float = Field(default=10, ge=1, le=60)
|
||||
@@ -97,6 +98,7 @@ class Settings(BaseSettings):
|
||||
"contact_user_id_field": self.contact_user_id_field,
|
||||
"contact_registered_field": self.contact_registered_field,
|
||||
"contact_citizenship_field": self.contact_citizenship_field,
|
||||
"contact_source": self.contact_source,
|
||||
}
|
||||
missing = [name for name, value in required.items() if not value]
|
||||
if missing:
|
||||
@@ -110,6 +112,10 @@ class Settings(BaseSettings):
|
||||
raise ValueError(f"{name} must match UF_CRM_<latin letters or digits>")
|
||||
if not MEMBER_RE.fullmatch(str(self.portal_member_id)):
|
||||
raise ValueError("portal_member_id has invalid format")
|
||||
assert self.contact_source
|
||||
self.contact_source = self.contact_source.strip()
|
||||
if not self.contact_source:
|
||||
raise ValueError("contact_source cannot be blank")
|
||||
|
||||
crm = urlsplit(self.crm_rest_webhook_url.get_secret_value())
|
||||
public = urlsplit(str(self.public_base_url))
|
||||
|
||||
Reference in New Issue
Block a user