refactor(OpenCode TLS): 共用 httpsAgent 建立邏輯

This commit is contained in:
2026-06-20 13:42:25 +00:00
parent c662a2e362
commit babe599977
3 changed files with 10 additions and 5 deletions
+6
View File
@@ -1,3 +1,5 @@
import https from 'https';
export const GITEA_TOKEN = process.env.GITEA_TOKEN || '';
export const GITEA_COMMENT_TOKEN = process.env.GITEA_COMMENT_TOKEN || '';
export const GITEA_SERVER_URL = process.env.GITEA_SERVER_URL || 'https://gitea.com';
@@ -15,6 +17,10 @@ export function shouldSkipOpenCodeTLSVerify() {
return process.env.OPENCODE_SKIP_TLS_VERIFY === 'true';
}
export function getOpenCodeHttpsAgent() {
return shouldSkipOpenCodeTLSVerify() ? new https.Agent({ rejectUnauthorized: false }) : undefined;
}
/** 將逗號分隔的 API key 字串拆成陣列 */
function splitKeys(value) {
if (!value) return [];