环境变量
Verdaccio 提供了一组环境变量,用于修改权限、端口或 http 协议。 以下是完整列表:
Docker
要在运行映像时更改运行时的行为,以下是可用变量列表。
| 变量 | 默认值 | 描述 |
|---|---|---|
| VERDACCIO_APPDIR | /opt/verdaccio | docker 工作目录 |
| VERDACCIO_USER_NAME | verdaccio | 系统用户 |
| VERDACCIO_USER_UID | 10001 | 授予目录权限的 user id |
| VERDACCIO_PORT | 4873 | Verdaccio 端口 |
| VERDACCIO_PROTOCOL | http | 默认 HTTP 协议 |
| VERDACCIO_ADDRESS | 0.0.0.0 | the default address to listen on 0.0.0.0 |
VERDACCIO_HANDLE_KILL_SIGNALS
Enables gracefully shutdown, more info at the pull request #2121.
VERDACCIO_PUBLIC_URL
Define a specific public url for your server, it overrules the Host and X-Forwarded-Proto header if a reverse proxy is being used, it takes in account the url_prefix if is defined.
这在需要动态 url 的情况下非常方便。
例如:
VERDACCIO_PUBLIC_URL='https://somedomain.org';
url_prefix: '/my_prefix'
// url -> https://somedomain.org/my_prefix/
VERDACCIO_PUBLIC_URL='https://somedomain.org';
url_prefix: '/'
// url -> https://somedomain.org/
VERDACCIO_PUBLIC_URL='https://somedomain.org/first_prefix';
url_prefix: '/second_prefix'
// url -> https://somedomain.org/second_prefix/'
VERDACCIO_FORWARDED_PROTO
The default header to identify the protocol is X-Forwarded-Proto, but there are some environments which uses something different, to change it use the variable VERDACCIO_FORWARDED_PROTO
$ VERDACCIO_FORWARDED_PROTO=CloudFront-Forwarded-Proto verdaccio --listen 5000
VERDACCIO_STORAGE_PATH
默认情况下,存储位置来自配置文件,但使用此变量可以通过环境变量进行设置。
VERDACCIO_STORAGE_NAME
The database name for @verdaccio/local-storage is by default .verdaccio-db.json, but this can be update by using this variable.