japi/apps/jupscale/settings.py

39 lines
1.1 KiB
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 = 8109
debug: bool = False
# API路由配置
router_prefix: str = "/jupscale"
upscale_route: str = "/upscale" # 放大图片的路由
batch_route: str = "/batch" # 批量放大图片的路由
api_name: str = "jupscale" # 默认API名称
save_dir: str = "../jfile/files"
# Japi 静态资源下载URL
download_url: str = "http://api.jingrow.com:9080/files"
# 中转图床服务上传URL
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 = "192.168.2.200:8188"
class Config:
env_file = ".env"
@lru_cache()
def get_settings() -> Settings:
return Settings()
# 创建全局配置实例
settings = get_settings()