CalejoControl/config/settings.py

41 lines
1.1 KiB
Python
Raw Normal View History

"""
Application settings for Calejo Control Adapter.
"""
from pydantic_settings import BaseSettings
from typing import Optional
class Settings(BaseSettings):
"""Application settings loaded from environment variables."""
# Database
database_url: str = "postgresql://control_reader:secure_password@localhost:5432/calejo"
# Protocol endpoints
opc_ua_endpoint: str = "opc.tcp://0.0.0.0:4840"
modbus_port: int = 502
rest_api_port: int = 8080
# Safety settings
safety_timeout_seconds: int = 1200 # 20 minutes
# Security settings
jwt_secret_key: str = "your-secret-key-change-in-production"
jwt_algorithm: str = "HS256"
# Alert settings
smtp_server: Optional[str] = None
smtp_port: Optional[int] = 587
smtp_username: Optional[str] = None
smtp_password: Optional[str] = None
twilio_account_sid: Optional[str] = None
twilio_auth_token: Optional[str] = None
twilio_phone_number: Optional[str] = None
# Logging
log_level: str = "INFO"
class Config:
env_file = ".env"
env_file_encoding = "utf-8"