Features: - FastAPI backend with JWT authentication - MySQL database with SQLAlchemy ORM - KPI workflow: draft → pending → approved → evaluation → completed - Ollama LLM API integration for AI features - Gitea API integration for version control - Complete API endpoints for KPI, dashboard, notifications Tables: KPI_D_* prefix naming convention 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
53 lines
1.2 KiB
Python
53 lines
1.2 KiB
Python
"""
|
|
應用程式設定
|
|
"""
|
|
from functools import lru_cache
|
|
from pydantic_settings import BaseSettings
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
"""應用程式設定"""
|
|
|
|
# App
|
|
APP_NAME: str = "KPI Management System"
|
|
DEBUG: bool = True
|
|
|
|
# Database (MySQL)
|
|
DB_HOST: str = "mysql.theaken.com"
|
|
DB_PORT: int = 33306
|
|
DB_NAME: str = "db_A102"
|
|
DB_USER: str = "A102"
|
|
DB_PASSWORD: str = "Bb123456"
|
|
|
|
@property
|
|
def DATABASE_URL(self) -> str:
|
|
return f"mysql+pymysql://{self.DB_USER}:{self.DB_PASSWORD}@{self.DB_HOST}:{self.DB_PORT}/{self.DB_NAME}"
|
|
|
|
# JWT
|
|
SECRET_KEY: str = "your-super-secret-key-change-in-production"
|
|
ALGORITHM: str = "HS256"
|
|
ACCESS_TOKEN_EXPIRE_MINUTES: int = 30
|
|
REFRESH_TOKEN_EXPIRE_DAYS: int = 7
|
|
|
|
# Ollama LLM API
|
|
OLLAMA_API_URL: str = "https://ollama_pjapi.theaken.com"
|
|
OLLAMA_DEFAULT_MODEL: str = "qwen2.5:3b"
|
|
|
|
# Gitea
|
|
GITEA_URL: str = "https://gitea.theaken.com"
|
|
GITEA_USER: str = "donald"
|
|
GITEA_TOKEN: str = "9e0a888d1a25bde9cf2ad5dff2bb7ee6d68d6ff0"
|
|
|
|
class Config:
|
|
env_file = ".env"
|
|
case_sensitive = True
|
|
|
|
|
|
@lru_cache
|
|
def get_settings() -> Settings:
|
|
"""取得設定單例"""
|
|
return Settings()
|
|
|
|
|
|
settings = get_settings()
|