Skip to main content

命令行接口参考

pnpr [OPTIONS]

选项

🌐 Options

标志描述
-c, --config <path>指向 YAML 配置 的路径。若省略,将使用 pnpr 配置目录中的全局 config.yaml(如果存在),否则使用打包的默认配置。
--listen <addr>要绑定的地址。默认为 127.0.0.1:7677
--storage <path>覆盖已加载配置中的 storage 目录 —— 托管包的真实来源。
--cache <path>覆盖一次性代理缓存目录(上游注册表的镜像加上解析器缓存)。默认是存储路径的 .pnpr-cache 子目录。
--public-url <url>URL 客户端应使用此 URL 来访问服务器,用于在提供的包清单中重写 dist.tarball URL。默认值为 http://<listen>
--packument-ttl-secs <n>在缓存的包清单被认为过期并重新获取之前的秒数。如果省略,将使用已加载配置的值。
--osv启用本地 OSV npm 漏洞检查。需要在 --osv-db<cache>/osv/npm/all.zip 拥有本地 OSV npm 数据库压缩包。
--osv-db <path>本地 OSV npm 数据库 zip 文件或已解压 JSON 目录的路径。
--disable-registry禁用 npm 注册表功能面(packument 和 tarball 读取、发布、取消发布、dist-tags 以及搜索),这些功能通常在配置声明至少一个注册表时提供。健康检查和登录/令牌端点仍然可用。
--disable-resolver禁用安装加速器界面:GET /-/pnprPOST /-/pnpr/v0/resolvePOST /-/pnpr/v0/verify-lockfile。覆盖 resolver.enabled
-h, --help打印帮助。
-V, --version打印版本。

记录

🌐 Logging

日志级别由标准的 RUST_LOG 环境变量控制,该变量总是优先于配置文件中设置的级别:

🌐 The log level is controlled with the standard RUST_LOG environment variable, which always wins over the level set in the config file:

RUST_LOG=debug pnpr

配置 log.level 接受 tracedebughttpinfowarnerrorhttp 使每个请求生成一条访问日志记录,同时保持其余部分更安静。

🌐 The config log.level accepts trace, debug, http, info, warn, and error. http enables one access-log record per request while keeping the rest of the crate quieter.

示例

🌐 Examples

绑定到所有接口,并告知客户端通过公共主机名访问服务器:

🌐 Bind to all interfaces and tell clients to reach the server through a public hostname:

pnpr --listen 0.0.0.0:7677 --public-url https://registry.example.com

使用自定义配置和独立的临时缓存卷运行:

🌐 Run with a custom config and a separate, ephemeral cache volume:

pnpr -c ./pnpr.yaml --cache /mnt/ephemeral/pnpr-cache

仅运行 pnpr 解析器端点,而不暴露 npm 注册表界面:

🌐 Run only the pnpr resolver endpoints, without exposing an npm registry surface:

pnpr --disable-registry