fix rust
This commit is contained in:
59
python/api/app/core/config.py
Normal file
59
python/api/app/core/config.py
Normal file
@ -0,0 +1,59 @@
|
||||
"""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 = "sqlite+aiosqlite:///~/.config/syui/ai/card/aicard.db"
|
||||
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",
|
||||
"http://localhost:5173",
|
||||
"http://localhost:4173",
|
||||
"https://card.syui.ai",
|
||||
"https://xxxcard.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()
|
Reference in New Issue
Block a user