Skip to main content

插件

Verdaccio是一个可插入式应用程序。 它可以通过多种方式扩展,可以是新的认证方法,添加端点或者使用定制存储。

There are 4 types of plugins:

如果您感兴趣开发自己的插件,请阅读开发部分。

使用

安装

$> npm install --global verdaccio-activedirectory

verdaccio as a sinopia fork it has backward compatibility with plugins that are compatible with sinopia@1.4.0. In such case the installation is the same.

$> npm install --global sinopia-memory

Configuration

打开config.yaml文件并按如下说明更新auth部分:

默认配置如下所示,由于在默认情况下我们使用一个内置的htpasswd插件,我们可以通过注释下面几行代码来禁用它:

Authentication Configuration

  htpasswd:
file: ./htpasswd
#max_users: 1000

如果你决定使用ldap插件,将上述部分进行替换。

auth:
activedirectory:
url: "ldap://10.0.100.1"
baseDN: 'dc=sample,dc=local'
domainSuffix: 'sample.local'

Multiple Authentication plugins

This is tecnically possible, making the plugin order important, as the credentials will be resolved in order.

auth:
htpasswd:
file: ./htpasswd
#max_users: 1000
activedirectory:
url: "ldap://10.0.100.1"
baseDN: 'dc=sample,dc=local'
domainSuffix: 'sample.local'

Middleware Configuration

This is an example how to set up a middleware plugin. This is an example how to set up a middleware plugin. All middleware plugins must be defined in the middlewares namespace.

middlewares:
audit:
enabled: true

您可以跟着audit middle plugin(审核中间插件)的基本范例。

Storage Configuration

This is an example how to set up a storage plugin. This is an example how to set up a storage plugin. All storage plugins must be defined in the store namespace.

store:
memory:
limit: 1000

Theme Configuration

Verdaccio allows to replace the User Interface with a custom one, we call it theme. By default, uses @verdaccio/ui-theme that comes built-in, but, you can use something different installing your own plugin. By default, uses @verdaccio/ui-theme that comes built-in, but, you can use something different installing your own plugin.


<br />$> npm install --global verdaccio-theme-dark

The plugin name prefix must start with verdaccio-theme, otherwise the plugin won't load.

You can load only one theme at the time and pass through options if is need it.

theme:
dark:
option1: foo
option2: bar

旧式插件

Sinopia插件

If you are relying on any sinopia plugin, remember are deprecated and might no work in the future.

所有sinopia 插件都应该和所有verdaccio将来版本兼容。 无论如何,我们鼓励贡献者们迁移到 modern verdaccio API并使用 verdaccio-xx-name为前缀。