Files

32 lines
1.4 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""应用配置中心。
集中读取环境变量并推导路径常量,避免业务代码散落魔法值。路径统一使用
pathlibWindows 与 Linux 开发环境均可用。
"""
from __future__ import annotations
import os
import sys
from pathlib import Path
# WOV 工作区根目录:wov-api 位于其下的子目录,父目录即 meta-repo。
WORKSPACE_ROOT = Path(__file__).resolve().parent.parent.parent
# wov-sdk 使用 src 布局,启动时加入 PYTHONPATH 以便直接导入。
SDK_SRC = WORKSPACE_ROOT / "wov-sdk" / "src"
if str(SDK_SRC) not in sys.path:
sys.path.insert(0, str(SDK_SRC))
# 数据目录、SQLite 文件与产物存储目录均可通过环境变量覆盖,便于测试隔离。
DATA_DIR = Path(os.getenv("WOV_DATA_DIR", str(WORKSPACE_ROOT / "wov-api" / "data")))
DB_PATH = Path(os.getenv("WOV_DB_PATH", str(DATA_DIR / "wov.db")))
STORAGE_DIR = Path(os.getenv("WOV_STORAGE_DIR", str(DATA_DIR / "storage")))
# 节点回收线程的轮询间隔。
NODE_REAP_INTERVAL_SECONDS = float(os.getenv("WOV_REAP_INTERVAL_SECONDS", "3"))
# 节点进程启动后等待 WOV_NODE_READY 与健康检查的超时。
NODE_READY_TIMEOUT_SECONDS = float(os.getenv("WOV_READY_TIMEOUT_SECONDS", "12"))
# 单次节点调用(POST /invoke)的 HTTP 超时,LLM 等慢节点需要放宽。
NODE_INVOKE_TIMEOUT_SECONDS = float(os.getenv("WOV_NODE_INVOKE_TIMEOUT_SECONDS", "3600"))