28 lines
968 B
Python
28 lines
968 B
Python
|
|
from functools import lru_cache
|
||
|
|
from typing import Optional
|
||
|
|
|
||
|
|
from pydantic import Field
|
||
|
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
||
|
|
|
||
|
|
|
||
|
|
class Settings(BaseSettings):
|
||
|
|
db_url: str = Field(
|
||
|
|
"mysql+asyncmy://root:password@localhost:3306/aws_ec2_panel?charset=utf8mb4",
|
||
|
|
description="SQLAlchemy database URL",
|
||
|
|
)
|
||
|
|
jwt_secret: str = Field("change-me", description="Secret used to sign JWT tokens")
|
||
|
|
jwt_expire_minutes: int = Field(60, description="JWT expiration in minutes")
|
||
|
|
jwt_algorithm: str = Field("HS256", description="JWT signing algorithm")
|
||
|
|
aws_proxy_url: Optional[str] = Field(default=None, description="Optional proxy URL for AWS SDK")
|
||
|
|
aws_timeout: int = Field(30, description="Timeout seconds for AWS API calls")
|
||
|
|
|
||
|
|
model_config = SettingsConfigDict(env_file=".env", env_prefix="", extra="ignore")
|
||
|
|
|
||
|
|
|
||
|
|
@lru_cache(maxsize=1)
|
||
|
|
def get_settings() -> Settings:
|
||
|
|
return Settings()
|
||
|
|
|
||
|
|
|
||
|
|
settings = get_settings()
|