Refactoring file structure, not tested yet

This commit is contained in:
2026-03-03 11:05:19 +02:00
parent b5ed0d678a
commit 7eede1f99b
14 changed files with 500 additions and 121 deletions
+36
View File
@@ -0,0 +1,36 @@
# app/core/config.py
from functools import lru_cache
from pydantic_settings import BaseSettings, SettingsConfigDict
class Settings(BaseSettings):
# App
app_name: str = "URL Shortener API"
debug: bool = False
# Server
host: str = "0.0.0.0"
port: int = 8000
base_url: str = "http://localhost:8000"
# Database
database_url: str = "sqlite:///./urls.db"
# Optional future extensions
allowed_hosts: list[str] = ["*"]
rate_limit_per_minute: int = 60
model_config = SettingsConfigDict(
env_file=".env",
env_file_encoding="utf-8",
case_sensitive=False,
extra="ignore",
)
@lru_cache
def get_settings() -> Settings:
return Settings()
# Singleton-style access
settings = get_settings()