mirror of
https://github.com/foxhui/WebAI2API.git
synced 2026-06-16 21:03:59 +08:00
feat: 尝试兼容 Docker 环境
This commit is contained in:
@@ -113,6 +113,14 @@ export function loadConfig() {
|
||||
const configFile = fs.readFileSync(CONFIG_PATH, 'utf8');
|
||||
const config = yaml.parse(configFile);
|
||||
|
||||
// Docker 路径兼容处理
|
||||
if ((!config.browser?.path || !fs.existsSync(config.browser.path)) &&
|
||||
fs.existsSync('/app/camoufox/camoufox')) {
|
||||
logger.info('配置器', '检测到容器环境,自动修正浏览器路径为 /app/camoufox/camoufox');
|
||||
if (!config.browser) config.browser = {};
|
||||
config.browser.path = '/app/camoufox/camoufox';
|
||||
}
|
||||
|
||||
// 基础配置校验
|
||||
if (!config.server || !config.server.port) {
|
||||
throw new Error('配置文件缺少必需字段: server.port');
|
||||
|
||||
Reference in New Issue
Block a user