42 lines
1.1 KiB
Python
42 lines
1.1 KiB
Python
"""Application configuration using Pydantic settings."""
|
|
|
|
from functools import lru_cache
|
|
from pydantic_settings import BaseSettings
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
"""Application settings loaded from environment variables."""
|
|
|
|
# Database
|
|
database_url: str = "mysql+pymysql://mguard:password@localhost:3306/mguard_vpn"
|
|
|
|
# Security
|
|
secret_key: str = "change-me-in-production"
|
|
algorithm: str = "HS256"
|
|
access_token_expire_minutes: int = 60 * 24 # 24 hours
|
|
refresh_token_expire_days: int = 7
|
|
|
|
# OpenVPN Management Interface
|
|
openvpn_management_host: str = "openvpn"
|
|
openvpn_management_port: int = 7505
|
|
|
|
# VPN Network
|
|
vpn_network: str = "10.8.0.0"
|
|
vpn_netmask: str = "255.255.255.0"
|
|
vpn_server_address: str = "vpn.example.com" # External address for clients to connect
|
|
|
|
# Admin defaults
|
|
admin_username: str = "admin"
|
|
admin_password: str = "changeme"
|
|
admin_email: str = "admin@example.com"
|
|
|
|
class Config:
|
|
env_file = ".env"
|
|
case_sensitive = False
|
|
|
|
|
|
@lru_cache()
|
|
def get_settings() -> Settings:
|
|
"""Get cached settings instance."""
|
|
return Settings()
|