note/api/config.py
2026-04-23 20:42:16 +08:00

21 lines
472 B
Python

# config.py
from pydantic_settings import BaseSettings
import os
from dotenv import load_dotenv
# 加载环境变量
load_dotenv()
class Settings(BaseSettings):
DATABASE_URL: str = os.getenv("DATABASE_URL", "postgresql://postgres:password@localhost:5432/postgres")
TITLE: str = os.getenv("TITLE", "Note")
VERSION: str = os.getenv("VERSION", "1.0.0")
DEBUG: bool = os.getenv("DEBUG", "false").lower()
# 创建全局配置实例
settings = Settings()