Implement reconnect, idle reporting, and security hardening

This commit is contained in:
2026-02-16 23:03:02 +09:00
parent 582c19bb50
commit ebe7902362
8 changed files with 165 additions and 6 deletions

View File

@@ -25,3 +25,26 @@ class Config:
# Buffer
output_buffer_interval: float = float(os.getenv("OUTPUT_BUFFER_INTERVAL", "2.0"))
max_message_length: int = int(os.getenv("MAX_MESSAGE_LENGTH", "3000"))
# Status reporting / reconnect
reconnect_delay_seconds: float = float(os.getenv("RECONNECT_DELAY_SECONDS", "5.0"))
output_idle_report_seconds: int = int(
os.getenv("OUTPUT_IDLE_REPORT_SECONDS", "120")
)
input_idle_report_seconds: int = int(os.getenv("INPUT_IDLE_REPORT_SECONDS", "300"))
def validate_required_settings(self) -> None:
"""필수 설정값 누락 여부를 검증한다."""
missing: list[str] = []
if not self.slack_bot_token:
missing.append("SLACK_BOT_TOKEN")
if not self.slack_app_token:
missing.append("SLACK_APP_TOKEN")
if not self.allowed_user_id:
missing.append("SLACK_ALLOWED_USER_ID")
if not self.allowed_channel_id:
missing.append("SLACK_ALLOWED_CHANNEL_ID")
if missing:
joined = ", ".join(missing)
raise ValueError(f"필수 환경 변수가 누락되었습니다: {joined}")