mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-11-17 07:45:52 +01:00
374f0a8bd0
* New translations uplinks.md (Chinese Simplified) docs(website): new translations * New translations uplinks.md (Chinese Simplified) docs(website): new translations * New translations uplinks.md (Chinese Simplified) docs(website): new translations * New translations uplinks.md (Chinese Simplified) docs(website): new translations * New translations uplinks.md (Chinese Simplified) docs(website): new translations * New translations uplinks.md (Chinese Simplified) docs(website): new translations * New translations uplinks.md (Chinese Simplified) docs(website): new translations * New translations uplinks.md (Chinese Simplified) docs(website): new translations * New translations test.md (Chinese Simplified) docs(website): new translations * New translations test.md (Chinese Simplified) docs(website): new translations * New translations test.md (Chinese Simplified) docs(website): new translations * New translations test.md (Chinese Simplified) docs(website): new translations * New translations test.md (Chinese Simplified) docs(website): new translations * New translations test.md (Chinese Simplified) docs(website): new translations * New translations test.md (Chinese Simplified) docs(website): new translations * New translations test.md (Chinese Simplified) docs(website): new translations * New translations test.md (Chinese Simplified) docs(website): new translations * New translations test.md (Chinese Simplified) docs(website): new translations * New translations test.md (Chinese Simplified) docs(website): new translations * New translations use-cases.md (Chinese Simplified) docs(website): new translations * New translations use-cases.md (Chinese Simplified) docs(website): new translations * New translations use-cases.md (Chinese Simplified) docs(website): new translations * New translations use-cases.md (Chinese Simplified) docs(website): new translations * New translations use-cases.md (Chinese Simplified) docs(website): new translations * New translations use-cases.md (Chinese Simplified) docs(website): new translations * New translations use-cases.md (Chinese Simplified) docs(website): new translations * New translations web.md (Chinese Simplified) docs(website): new translations * New translations web.md (Chinese Simplified) docs(website): new translations
4.8 KiB
4.8 KiB
id | title |
---|---|
uplinks | Uplinks |
上行链路 是指可以访问到外部包的外部注册服务器地址。
用法
uplinks:
npmjs:
url: https://registry.npmjs.org/
server2:
url: http://mirror.local.net/
timeout: 100ms
server3:
url: http://mirror2.local.net:9000/
baduplink:
url: http://localhost:55666/
配置
你可以定义多个上行链路,每一个都必须有唯一的名称(键值). 它们可以有多个属性:
属性 | 类型 | 必须的 | 范例 | 支持版本 | 描述 | 默认值 |
---|---|---|---|---|---|---|
url | string | 是 | https://registry.npmjs.org/ | 全部 | 外部注册服务器URL | npmjs |
ca | string | 否 | ~./ssl/client.crt' | 全部 | SSL证书文件路径 | 无默认值 |
timeout | string | 否 | 100ms | 全部 | 为请求设置新的超时时间 | 30s |
maxage | string | 否 | 10m | 全部 | 请求返回信息时效,在此时间内不会发起相同的请求 | 2m |
fail_timeout | string | 否 | 10m | 全部 | 请求在连续失败超过指定次数后的最长等待重试时间 | 5m |
max_fails | number | 否 | 2 | 全部 | 请求连续失败的最大次数限制 | 2 |
cache | boolean | 否 | [true,false] | >= 2.1 | 缓存下载的远程tarball文件到本地 | true |
auth | list | 否 | 见下文 | >= 2.5 | 指定“授权authorization”请求头的内容 详情见 | disabled |
headers | list | 否 | authorization: "Bearer SecretJWToken==" | 全部 | 上行链路请求的请求头header列表 | disabled |
strict_ssl | boolean | 否 | [true,false] | >= 3.0 | 为true时,会检测SSL证书的有效性 | true |
Auth属性
auth
属性内容是向上行链路发起请求时提供的授权令牌。例如使用默认环境变量:
uplinks:
private:
url: https://private-registry.domain.com/registry
auth:
type: bearer
token_env: true # defaults to `process.env['NPM_TOKEN']`
或者使用一个指定的环境变量
uplinks:
private:
url: https://private-registry.domain.com/registry
auth:
type: bearer
token_env: FOO_TOKEN
token_env: FOO_TOKEN
内部将使用 process.env['FOO_TOKEN']
或者直接指定令牌:
uplinks:
private:
url: https://private-registry.domain.com/registry
auth:
type: bearer
token: "token"
注意:
token
的优先级高于token_env
须知
- 自版本
v2.3.0
以来, Verdaccio 不在使用Basic Authentication。verdaccio 所生成的所有令牌都基于 JWT (JSON Web Token) - 上行链路必须是兼容
npm
的注册服务器 例如: verdaccio,sinopia@1.4.0
, npmjs registry, yarn registry, JFrog, Nexus and more. - 设置
cache
为false可以帮助节省你的硬盘空间。 This will avoid storetarballs
but it will keep metadata in folders. - 配置过多的上行链路会导致包查询速度变慢,这是因为相比较一个npm客户端每发送一次的请求,verdaccio却需要向每个上行链路都发送一次这样的请求
- 这些属性(timeout, maxage and fail_timeout) 的配置单位格式参考NGINX measurement units