* New translations use-cases.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 what-is-verdaccio.md (Chinese Simplified) docs(website): new translations * New translations what-is-verdaccio.md (Chinese Simplified) docs(website): new translations * New translations what-is-verdaccio.md (Chinese Simplified) docs(website): new translations * New translations windows.md (Chinese Simplified) docs(website): new translations * New translations what-is-verdaccio.md (Chinese Simplified) docs(website): new translations * New translations windows.md (Chinese Simplified) docs(website): new translations * New translations windows.md (Chinese Simplified) docs(website): new translations * New translations windows.md (Chinese Simplified) docs(website): new translations * New translations windows.md (Chinese Simplified) docs(website): new translations * New translations en.json (Chinese Simplified) docs(website): new translations * New translations en.json (Chinese Simplified) docs(website): new translations * New translations plugins.md (Chinese Simplified) docs(website): new translations * New translations en.json (Chinese Simplified) docs(website): new translations * New translations plugins.md (Chinese Simplified) docs(website): new translations * New translations config.md (Chinese Simplified) docs(website): new translations * New translations config.md (Chinese Simplified) docs(website): new translations * New translations config.md (Chinese Simplified) docs(website): new translations * New translations config.md (Chinese Simplified) docs(website): new translations * New translations config.md (Chinese Simplified) docs(website): new translations * New translations config.md (Chinese Simplified) docs(website): new translations * New translations plugins.md (Chinese Simplified) docs(website): new translations * New translations uplinks.md (Chinese Simplified) docs(website): new translations * New translations what-is-verdaccio.md (Chinese Simplified) docs(website): new translations * New translations what-is-verdaccio.md (Chinese Simplified) docs(website): new translations * New translations docker.md (Chinese Simplified) docs(website): new translations * New translations docker.md (Chinese Simplified) docs(website): new translations
4.8 KiB
id | title |
---|---|
配置 | 配置文件 |
此文件是 Verdaccio 的重要部分, 您可以在其中修改默认行为, 启用插件并扩展功能。
一个默认的配置文件已经在您首次运行 Verdaccio
时创建。
默认配置
默认配置支持 ** 私有(scoped) ** 包, 并允许匿名访问非私有包, 但只有 ** 已登陆用户才能发布包**。
storage: ./storage
auth:
htpasswd:
file: ./htpasswd
uplinks:
npmjs:
url: https://registry.npmjs.org/
packages:
'@*/*':
access: $all
publish: $authenticated
proxy: npmjs
'**':
proxy: npmjs
logs:
- {type: stdout, format: pretty, level: http}
模块
以下各模块解释了每个属性的含义以及不同的选项。
存储
是默认的存储方式。** Verdaccio 默认使用内置本地文件模式存储 **。
storage: ./storage
插件
是插件目录的位置。对Docker/Kubernetes 基础上的配置非常有用。
plugins: ./plugins
认证
认证设置在这里完成,默认的授权是基于htpasswd
并且是内置的。 您可以通过plugins来修改此行为。 有关更多本模块的详细信息,请阅读auth页面。
auth:
htpasswd:
file: ./htpasswd
max_users: 1000
Web UI
此属性让您可以修改此web UI的外观和感觉。有关更多本模块的详细信息,请阅读 web ui页面。
web:
enable: true
title: Verdaccio
logo: logo.png
上行链路
当包不在本地的时候,上行链路可以让系统从远程的registry里获取这些包。 有关更多本模块的详细信息,请阅读上行链路页面。
uplinks:
npmjs:
url: https://registry.npmjs.org/
包
包让用户控制访问包的权限。有关更多本模块的详细信息,请阅读包页面。
packages:
'@*/*':
access: $all
publish: $authenticated
proxy: npmjs
高级设置
脱线发布
verdaccio
默认不允许客户脱线的时候发布,可以把这设置为true来覆盖此行为。
publish:
allow_offline: false
Since: verdaccio@2.3.6
due #223
URL 前缀
url_prefix: https://dev.company.local/verdaccio/
Since: verdaccio@2.3.6
due #197
最大正文大小
默认的最大JSON 文件正文大小为10mb
, 如果遇到"request entity too large"
的错误提示,您可以增大此数值。
max_body_size: 10mb
监听端口
verdaccio
默认在4873
端口运行。可以通过cli 或者在配置文件里更改端口,以下选项有效。
listen:
# - localhost:4873 # default value
# - http://localhost:4873 # same thing
# - 0.0.0.0:4873 # listen on all addresses (INADDR_ANY)
# - https://example.org:4873 # if you want to use https
# - "[::1]:4873" # ipv6
# - unix:/tmp/verdaccio.sock # unix socket
HTTPS
要在 verdaccio
启用https
,只要用 *https://*协议来设置listen
标志。 有关更多本模块的详细信息,请阅读 ssl page。
https:
key: ./path/verdaccio-key.pem
cert: ./path/verdaccio-cert.pem
ca: ./path/verdaccio-csr.pem
Proxy
Proxy是专门把数据从远程服务器传输到本地客户端的HTTP 服务器。
http_proxy and https_proxy
如果您的网络里有proxy,您可以用以下属性设置X-Forwarded-For
页眉。
http_proxy: http://something.local/
https_proxy: https://something.local/
no_proxy
此变量应该包含一个proxy 本不应该用到的以逗号分开的域名扩展列表。
no_proxy: localhost,127.0.0.1
通知
通过web hooks来启用第三方工具通知是很容易的。有关更多本模块的详细信息,请阅读 notifications page(通知页面)。
notify:
method: POST
headers: [{'Content-Type': 'application/json'}]
endpoint: https://usagge.hipchat.com/v2/room/3729485/notification?auth_token=mySecretToken
content: '{"color":"green","message":"New package published: * {{ name }}*","notify":true,"message_format":"text"}'
有关更多配置设置的详细信息,请核对源代码。
审核
Since: verdaccio@3.0.0
npm audit
是和npm 6.x一起发布的新命令。Verdaccio 包含一个内置的middleware plugin(中间插件)来处理此命令。
新安装采用默认版本,但是您可以添加以下代码段到配置文件中
middlewares:
audit:
enabled: true