35 lines
966 B
Python
35 lines
966 B
Python
from pydantic_settings import BaseSettings
|
|
from typing import Optional
|
|
from functools import lru_cache
|
|
|
|
class Settings(BaseSettings):
|
|
# Japi Server 配置
|
|
host: str = "0.0.0.0"
|
|
port: int = 8103
|
|
debug: bool = False
|
|
|
|
# API路由配置
|
|
router_prefix: str = "/jart_v1"
|
|
generate_route: str = "/generate" # 生成图片的路由
|
|
batch_route: str = "/batch" # 批量生成图片的路由
|
|
api_name: str = "jart_v1" # 默认API名称
|
|
|
|
upload_url: str = "http://images.jingrow.com:8080/api/v1/image"
|
|
|
|
# Jingrow Jcloud API 配置
|
|
jingrow_api_url: str = "https://cloud.jingrow.com"
|
|
jingrow_api_key: Optional[str] = None
|
|
jingrow_api_secret: Optional[str] = None
|
|
|
|
# Stable Diffusion配置
|
|
comfyui_server_address: str = "comfyui.jingrow.com:8188"
|
|
|
|
class Config:
|
|
env_file = ".env"
|
|
|
|
@lru_cache()
|
|
def get_settings() -> Settings:
|
|
return Settings()
|
|
|
|
# 创建全局配置实例
|
|
settings = get_settings() |