feat: ca and cert may be set to an array of strings

This commit is contained in:
Zoltan Kochan
2022-06-09 01:10:23 +03:00
parent bc80631d39
commit d5730ba815
3 changed files with 14 additions and 8 deletions

View File

@@ -0,0 +1,6 @@
---
"@pnpm/config": minor
"@pnpm/npm-registry-agent": minor
---
The ca and cert options may accept an array of string.

View File

@@ -85,9 +85,9 @@ export interface Config {
noProxy?: string | boolean
// ssl
cert?: string
cert?: string | string[]
key?: string
ca?: string
ca?: string | string[]
strictSsl?: boolean
userAgent?: string

View File

@@ -12,8 +12,8 @@ const DEFAULT_MAX_SOCKETS = 50
const AGENT_CACHE = new LRU({ max: 50 })
export interface AgentOptions {
ca?: string
cert?: string
ca?: string | string[]
cert?: string | string[]
httpProxy?: string
httpsProxy?: string
key?: string
@@ -37,8 +37,8 @@ export default function getAgent (uri: string, opts: AgentOptions) {
: '>no-proxy<',
`local-address:${opts.localAddress ?? '>no-local-address<'}`,
`strict-ssl:${isHttps ? Boolean(opts.strictSsl).toString() : '>no-strict-ssl<'}`,
`ca:${(isHttps && opts.ca) || '>no-ca<'}`,
`cert:${(isHttps && opts.cert) || '>no-cert<'}`,
`ca:${(isHttps && opts.ca?.toString()) || '>no-ca<'}`,
`cert:${(isHttps && opts.cert?.toString()) || '>no-cert<'}`,
`key:${(isHttps && opts.key) || '>no-key<'}`,
].join(':')
/* eslint-enable @typescript-eslint/prefer-nullish-coalescing */
@@ -143,8 +143,8 @@ function getProxyUri (
function getProxy (
proxyUrl: URL,
opts: {
ca?: string
cert?: string
ca?: string | string[]
cert?: string | string[]
key?: string
timeout?: number
localAddress?: string