1
0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-11-17 07:45:52 +01:00
verdaccio/website/translated_docs/zh-Hans/uplinks.md
verdacciobot 374f0a8bd0 New Crowdin translations (#847)
* 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
2018-07-28 09:14:57 +02:00

4.8 KiB
Raw Blame History

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 store tarballs but it will keep metadata in folders.
  • 配置过多的上行链路会导致包查询速度变慢这是因为相比较一个npm客户端每发送一次的请求verdaccio却需要向每个上行链路都发送一次这样的请求
  • 这些属性(timeout, maxage and fail_timeout) 的配置单位格式参考NGINX measurement units