japi/apps/jvector/settings.py

41 lines
1.2 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 = 8110
debug: bool = False
# API路由配置
router_prefix: str = "/jvector"
file_route: str = "/file" # 转矢量图的路由
batch_route: str = "/batch" # 批量转矢量图的路由
api_name: str = "jvector" # 默认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
# 矢量图转换服务配置
vector_api_id: Optional[str] = None
vector_api_secret: Optional[str] = None
vector_mode: str = "production" # 'test' 或 'production' 或 'preview'
class Config:
env_file = ".env"
@lru_cache()
def get_settings() -> Settings:
return Settings()
# 创建全局配置实例
settings = get_settings()