diff --git a/packages/core/src/config/schema.ts b/packages/core/src/config/schema.ts index b98ff25..76275a6 100644 --- a/packages/core/src/config/schema.ts +++ b/packages/core/src/config/schema.ts @@ -31,7 +31,6 @@ export interface ConfigFile { access_key_id?: string; access_key_secret?: string; workspace_id?: string; - console_gateway_url?: string; console_site?: "domestic" | "international"; console_region?: string; console_switch_agent?: number; @@ -43,8 +42,8 @@ const VALID_OUTPUTS = new Set(["text", "json"]); const VALID_CONSOLE_SITES = new Set(["domestic", "international"]); /** - * A syntactically valid absolute http(s) URL. Used to validate `base_url` and - * `console_gateway_url` from the config file: the credential-bearing client + * A syntactically valid absolute http(s) URL. Used to validate `base_url` + * from the config file: the credential-bearing client * sends the Bearer token to these origins, so a bare `startsWith("http")` check * (which also accepts e.g. "httpfoo://…") is too loose. */ @@ -91,8 +90,6 @@ export function parseConfigFile(raw: unknown): ConfigFile { out.access_key_secret = obj.access_key_secret; if (typeof obj.workspace_id === "string" && obj.workspace_id.length > 0) out.workspace_id = obj.workspace_id; - if (typeof obj.console_gateway_url === "string" && isHttpUrl(obj.console_gateway_url)) - out.console_gateway_url = obj.console_gateway_url; if (typeof obj.console_site === "string" && VALID_CONSOLE_SITES.has(obj.console_site)) out.console_site = obj.console_site as ConfigFile["console_site"]; if (typeof obj.console_region === "string" && obj.console_region.length > 0) diff --git a/packages/core/tests/index.test.ts b/packages/core/tests/index.test.ts index 704e7ad..fd433e1 100644 --- a/packages/core/tests/index.test.ts +++ b/packages/core/tests/index.test.ts @@ -199,7 +199,7 @@ test("parseBooleanValue accepts only true and false strings (case-insensitive)", expect(() => parseBooleanValue("maybe")).toThrow(BailianError); }); -test("parseConfigFile accepts only well-formed http(s) base_url / console_gateway_url", () => { +test("parseConfigFile accepts only well-formed http(s) base_url", () => { expect(parseConfigFile({ base_url: "https://dashscope.aliyuncs.com" }).base_url).toBe( "https://dashscope.aliyuncs.com", ); @@ -209,5 +209,4 @@ test("parseConfigFile accepts only well-formed http(s) base_url / console_gatewa // Previously accepted because the value merely "starts with http". expect(parseConfigFile({ base_url: "httpfoo://evil" }).base_url).toBeUndefined(); expect(parseConfigFile({ base_url: "not a url" }).base_url).toBeUndefined(); - expect(parseConfigFile({ console_gateway_url: "ftp://x" }).console_gateway_url).toBeUndefined(); });