32 lines
793 B
Python
32 lines
793 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 = 8106
|
|
debug: bool = False
|
|
|
|
# API路由配置
|
|
router_prefix: str = "/rmbg"
|
|
file_route: str = "/file"
|
|
batch_route: str = "/batch"
|
|
api_name: str = "remove_background"
|
|
|
|
upload_url: str = "http://173.255.202.68/imgurl/upload"
|
|
|
|
# Jingrow Jcloud API 配置
|
|
jingrow_api_url: str = "https://cloud.jingrow.com"
|
|
jingrow_api_key: Optional[str] = None
|
|
jingrow_api_secret: Optional[str] = None
|
|
|
|
class Config:
|
|
env_file = ".env"
|
|
|
|
@lru_cache()
|
|
def get_settings() -> Settings:
|
|
return Settings()
|
|
|
|
# 创建全局配置实例
|
|
settings = get_settings() |