48 lines
1.6 KiB
Python
48 lines
1.6 KiB
Python
import os
|
|
from pathlib import Path
|
|
from typing import List, Optional
|
|
from pydantic import field_validator
|
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
|
|
class Settings(BaseSettings):
|
|
# Project details
|
|
PROJECT_NAME: str = "AI Mental Health App"
|
|
PROJECT_DESCRIPTION: str = "AI-powered mental health application with Firebase, Dialogflow, and OpenAI integrations"
|
|
VERSION: str = "0.1.0"
|
|
API_V1_STR: str = "/api/v1"
|
|
DEBUG_MODE: bool = os.getenv("DEBUG_MODE", "False").lower() in ("true", "1", "t")
|
|
|
|
# Firebase configuration
|
|
FIREBASE_CREDENTIALS: Optional[str] = None
|
|
FIREBASE_DATABASE_URL: Optional[str] = None
|
|
|
|
# OpenAI configuration
|
|
OPENAI_API_KEY: Optional[str] = None
|
|
|
|
# Dialogflow configuration
|
|
DIALOGFLOW_PROJECT_ID: Optional[str] = None
|
|
DIALOGFLOW_LOCATION: str = "global"
|
|
DIALOGFLOW_AGENT_ID: Optional[str] = None
|
|
GOOGLE_APPLICATION_CREDENTIALS: Optional[str] = None
|
|
|
|
# SQLite Database settings
|
|
DB_DIR: Path = Path("/app/storage/db")
|
|
SQLALCHEMY_DATABASE_URL: str = f"sqlite:///{DB_DIR}/db.sqlite"
|
|
|
|
# JWT settings
|
|
SECRET_KEY: str = os.getenv("SECRET_KEY", "secret_key_for_development_only")
|
|
ACCESS_TOKEN_EXPIRE_MINUTES: int = int(os.getenv("ACCESS_TOKEN_EXPIRE_MINUTES", "30"))
|
|
|
|
# Security
|
|
ALLOWED_HOSTS: List[str] = ["*"]
|
|
|
|
# Model config
|
|
model_config = SettingsConfigDict(env_file=".env", case_sensitive=True)
|
|
|
|
@field_validator("DB_DIR")
|
|
def create_db_dir(cls, v):
|
|
"""Create database directory if it doesn't exist"""
|
|
v.mkdir(parents=True, exist_ok=True)
|
|
return v
|
|
|
|
settings = Settings() |