53 lines
1.5 KiB
Python
53 lines
1.5 KiB
Python
"""Application configuration"""
|
|
import os
|
|
from pathlib import Path
|
|
from typing import Optional
|
|
from pydantic_settings import BaseSettings
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
# Application
|
|
app_name: str = "ai.card"
|
|
app_version: str = "0.1.0"
|
|
debug: bool = False
|
|
|
|
# API
|
|
api_v1_prefix: str = "/api/v1"
|
|
|
|
# Database
|
|
database_url: str = "postgresql+asyncpg://postgres:postgres@localhost:5432/aicard"
|
|
database_url_supabase: Optional[str] = None
|
|
use_supabase: bool = False
|
|
|
|
# atproto
|
|
atproto_pds_url: Optional[str] = None
|
|
atproto_handle: Optional[str] = None
|
|
atproto_password: Optional[str] = None
|
|
|
|
# Card probabilities (in percentage)
|
|
prob_normal: float = 99.789
|
|
prob_rare: float = 0.1
|
|
prob_super_rare: float = 0.01
|
|
prob_kira: float = 0.1
|
|
prob_unique: float = 0.0001
|
|
|
|
# Unique card settings
|
|
max_unique_cards: int = 1000 # Maximum number of unique cards
|
|
|
|
# CORS
|
|
cors_origins: list[str] = ["http://localhost:3000", "https://card.syui.ai"]
|
|
|
|
# Security
|
|
secret_key: str = "your-secret-key-change-this-in-production"
|
|
|
|
class Config:
|
|
# 設定ファイルの優先順位: 1) 環境変数, 2) ~/.config/syui/ai/card/.env, 3) .env
|
|
config_dir = Path.home() / ".config" / "syui" / "ai" / "card"
|
|
env_file = [
|
|
str(config_dir / ".env"), # ~/.config/syui/ai/card/.env
|
|
".env" # カレントディレクトリの.env
|
|
]
|
|
env_file_encoding = "utf-8"
|
|
|
|
|
|
settings = Settings() |