mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-17 05:00:16 +00:00
fix(ai): OAuth login/refresh now respects HTTP proxy env vars
Extracted HTTP proxy setup to shared module and imported it from both stream.ts and oauth/index.ts. This ensures fetch() calls during OAuth flows (token exchange, refresh, project discovery) go through the proxy. fixes #1132
This commit is contained in:
parent
73839f876e
commit
469fb5d27c
4 changed files with 18 additions and 9 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import "./providers/register-builtins.js";
|
||||
import "./utils/http-proxy.js";
|
||||
|
||||
import { getApiProvider } from "./api-registry.js";
|
||||
import type {
|
||||
|
|
@ -14,15 +15,6 @@ import type {
|
|||
|
||||
export { getEnvApiKey } from "./env-api-keys.js";
|
||||
|
||||
// Set up http proxy according to env variables for `fetch` based SDKs in Node.js.
|
||||
// Bun has builtin support for this.
|
||||
if (typeof process !== "undefined" && process.versions?.node) {
|
||||
import("undici").then((m) => {
|
||||
const { EnvHttpProxyAgent, setGlobalDispatcher } = m;
|
||||
setGlobalDispatcher(new EnvHttpProxyAgent());
|
||||
});
|
||||
}
|
||||
|
||||
function resolveApiProvider(api: Api) {
|
||||
const provider = getApiProvider(api);
|
||||
if (!provider) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue