refactor(OpenCode TLS): 共用 httpsAgent 建立邏輯
This commit is contained in:
@@ -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 [];
|
||||
|
||||
Reference in New Issue
Block a user