47 lines
1.1 KiB
Python
47 lines
1.1 KiB
Python
"""
|
|
Application configuration
|
|
Loads from environment variables with defaults
|
|
"""
|
|
from pydantic_settings import BaseSettings
|
|
from functools import lru_cache
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
"""Application settings"""
|
|
|
|
# App
|
|
app_name: str = "Cisco Config Builder"
|
|
app_version: str = "0.1.0"
|
|
debug: bool = False
|
|
|
|
# API
|
|
api_prefix: str = "/api/v1"
|
|
|
|
# Database
|
|
database_url: str = "postgresql://cisco_user:cisco_pass@localhost:5432/cisco_builder"
|
|
|
|
# JWT
|
|
secret_key: str = "change-this-secret-key-in-production"
|
|
algorithm: str = "HS256"
|
|
access_token_expire_minutes: int = 30
|
|
|
|
# SSH / Netmiko
|
|
ssh_timeout: int = 30
|
|
ssh_port: int = 22
|
|
netmiko_device_type: str = "cisco_ios"
|
|
|
|
# Security
|
|
enable_ssh_push: bool = True
|
|
require_confirmation_before_push: bool = True
|
|
max_config_size_mb: int = 10
|
|
|
|
class Config:
|
|
env_file = ".env"
|
|
case_sensitive = False
|
|
|
|
|
|
@lru_cache()
|
|
def get_settings() -> Settings:
|
|
"""Get cached settings instance"""
|
|
return Settings()
|