govorov/backend/app/core/config.py

28 lines
998 B
Python

import os
from pydantic_settings import BaseSettings
from dotenv import load_dotenv
# Load .env file from the backend directory (one level up from core)
# BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# load_dotenv(os.path.join(BASE_DIR, '..', '.env')) # Adjust path if needed
# Or simply let pydantic-settings handle it by default if .env is in the root execution dir
load_dotenv()
class Settings(BaseSettings):
DATABASE_URL: str = "sqlite:///./default.db" # Default value if not in .env
# Настройки JWT удалены
# SECRET_KEY: str = "default_secret"
# ALGORITHM: str = "HS256"
# ACCESS_TOKEN_EXPIRE_MINUTES: int = 30
class Config:
env_file = ".env"
env_file_encoding = 'utf-8'
# If your .env file is not in the root directory where you run uvicorn,
# you might need to specify the path explicitly:
# env_file = '../.env' # Example if running from inside 'app' dir
settings = Settings()