mirror of
https://github.com/astral-sh/setup-uv.git
synced 2026-04-05 10:06:54 +00:00
Add input manifest-file (#454)
Adds capability to maintain custom uv builds or to override the default sources
This commit is contained in:
parent
7bbb36f434
commit
60cc2b4585
14 changed files with 493 additions and 126 deletions
21
src/utils/fetch.ts
Normal file
21
src/utils/fetch.ts
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
import { fetch as undiciFetch, ProxyAgent, type RequestInit } from "undici";
|
||||
|
||||
export function getProxyAgent() {
|
||||
const httpProxy = process.env.HTTP_PROXY || process.env.http_proxy;
|
||||
if (httpProxy) {
|
||||
return new ProxyAgent(httpProxy);
|
||||
}
|
||||
|
||||
const httpsProxy = process.env.HTTPS_PROXY || process.env.https_proxy;
|
||||
if (httpsProxy) {
|
||||
return new ProxyAgent(httpsProxy);
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export const fetch = async (url: string, opts: RequestInit) =>
|
||||
await undiciFetch(url, {
|
||||
dispatcher: getProxyAgent(),
|
||||
...opts,
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue