ENV=devFRONTEND_URL="http://localhost:3000"
from functools import lru_cache from pydantic_settings import BaseSettings, SettingsConfigDict class Settings(BaseSettings): """Main settings""" app_name: str = "demofirebase" env: str frontend_url: str model_config = SettingsConfigDict(env_file=".env") @lru_cachedef get_settings() -> Settings: """Retrieves the fastapi settings""" return Settings()
from fastapi import FastAPIfrom router import routerfrom config import get_settings settings = get_settings() print(settings.frontend_url) app = FastAPI() app.include_router(router)