diff --git a/src/govoplan_core/core/install_config.py b/src/govoplan_core/core/install_config.py index 7ef7caa..8d51f81 100644 --- a/src/govoplan_core/core/install_config.py +++ b/src/govoplan_core/core/install_config.py @@ -340,6 +340,7 @@ CELERY_ENABLED=true REDIS_URL=redis://127.0.0.1:6379/0 CELERY_QUEUES=send_email,append_sent,notifications,calendar,default CALENDAR_OUTBOX_TERMINAL_RETENTION_DAYS=90 +SCHEDULING_CANCELLATION_NOTICE_DAYS=30 # Deployment-wide connector egress policy. Enable private networks only when # this installation intentionally integrates with internal services. @@ -405,6 +406,7 @@ REDIS_URL=redis://127.0.0.1:56379/0 CELERY_ENABLED=true CELERY_QUEUES=send_email,append_sent,notifications,calendar,default CALENDAR_OUTBOX_TERMINAL_RETENTION_DAYS=90 +SCHEDULING_CANCELLATION_NOTICE_DAYS=30 GOVOPLAN_CONNECTOR_ALLOW_PRIVATE_NETWORKS=true GOVOPLAN_CONNECTOR_MAX_STRUCTURED_RESPONSE_BYTES=16777216 diff --git a/src/govoplan_core/settings.py b/src/govoplan_core/settings.py index a51d881..b77407d 100644 --- a/src/govoplan_core/settings.py +++ b/src/govoplan_core/settings.py @@ -76,6 +76,12 @@ class Settings(BaseSettings): ge=0, alias="CALENDAR_OUTBOX_TERMINAL_RETENTION_DAYS", ) + scheduling_cancellation_notice_days: int = Field( + default=30, + ge=1, + le=90, + alias="SCHEDULING_CANCELLATION_NOTICE_DAYS", + ) mock_mailbox_dir: str = Field(default="runtime/mock-mailbox", alias="MOCK_MAILBOX_DIR") # Development bootstrap only. Do not use this in production. diff --git a/tests/test_install_config.py b/tests/test_install_config.py index a351aec..7eca299 100644 --- a/tests/test_install_config.py +++ b/tests/test_install_config.py @@ -21,6 +21,18 @@ class InstallConfigTests(unittest.TestCase): with self.assertRaises(ValidationError): Settings(CALENDAR_OUTBOX_TERMINAL_RETENTION_DAYS="-1") + def test_scheduling_cancellation_notice_setting_is_bounded(self) -> None: + self.assertEqual(Settings().scheduling_cancellation_notice_days, 30) + self.assertEqual( + Settings( + SCHEDULING_CANCELLATION_NOTICE_DAYS="14" + ).scheduling_cancellation_notice_days, + 14, + ) + for invalid in ("0", "91"): + with self.subTest(invalid=invalid), self.assertRaises(ValidationError): + Settings(SCHEDULING_CANCELLATION_NOTICE_DAYS=invalid) + def test_self_hosted_validation_reports_actionable_missing_settings(self) -> None: result = validate_runtime_configuration({}, profile="self-hosted") @@ -113,6 +125,7 @@ class InstallConfigTests(unittest.TestCase): self.assertIn("GOVOPLAN_INSTALL_PROFILE=self-hosted", self_hosted) self.assertIn("MASTER_KEY_B64=