@greenlock/manager

中文文档
3.1.0发布于 2019/12/01MPL-2.0CommonJS近 30 天下载 1.9万

FileSytem-based Manager with optional encrypted Cloud backup for Greenlock SSL

原始使用文档
文档目录8 节
  1. Install
  2. Usage
  3. Initialize the Manager
  4. Set Subscriber and other global Defaults
  5. Add a sites - domains and SSL certificates
  6. View site config
  7. Update site config
  8. Remove a site

Greenlock Manager

Manages SSL Certificate issue and renewal for Greenlock.

Saves global and per-site config to a local File Sytem (current), with optional encrypted Cloud backup (coming soon).

Install

npm install --save greenlock@4
npm install --save greenlock-manager@3

Usage

To enable encrypted cloud backup, when it becomes available:

npx greenlock init --manager cloud --config-dir './greenlock.d'

For local file system only:

npx greenlock init --manager fs --config-dir './greenlock.d'

Or, place this file in the root of your project:

.greenlockrc:

{
    "manager": { "module": "@greenlock/manager" },
    "configDir": "./greenlock.d"
}

Greenlock Manager CLI & API

All manager plugins have the same API.

The manager-specific implementation is overlaid by Greenlock with error handling and common utilities, and then exposed as documented here.

Note: Most people do not need to (and should not) not use the JavaScript API. Instead, use the CLI (current) or Web API (coming soon).

Initialize the Manager

npx greenlock init --manager cloud --config-dir './greenlock.d'

Note: You should not initialize greenlock directly as this may make it incompatible with the CLI and Web GUI.

Instead use the file generated by the CLI init (shown above).

Greenlock.create({
    manager: "@greenlock/manager",
    cloud: true,
    configDir: "./greenlock.d",
    packageRoot: __dirname
});

Set Subscriber and other global Defaults

npx greenlock defaults --subscriber-email [email protected] --agree-to-terms true
greenlock.manager.defaults({
    subscriberEmail: "[email protected]",
    agreeToTerms: true
});

Site Management

By "site" we mean a primary domain and, optionally, secondary domains, to be listed on an ssl certificate, along with any configuration that is necessary for getting and renewing those certificates.

Add a sites - domains and SSL certificates

npx greenlock add --subject example.com --altnames 'example.com,www.example.com'
greenlock.sites.add({
    subject: "example.com",
    altnames: ["example.com", "www.example.com"]
});

View site config

npx greenlock config --subject example.com
greenlock.sites.get({
    servername: "www.example.com",
    wildname: "*.example.com"
});

Update site config

npx greenlock update --subject example.com --challenge-dns-01 acme-dns-01-ovh --challenge-dns-01-token xxxx
greenlock.sites.update({
    subject: "www.example.com",
    challenges: {
        "dns-01": {
            module: "acme-dns-01-ovh",
            token: "xxxx"
        }
    }
});

Remove a site

To stop automatic renewal of SSL certificates for a particular site. You to restart renewal you must use add().

npx greenlock remove --subject example.com
greenlock.sites.remove({
    subject: "example.com"
});

版本与发布记录

@greenlock/manager 共发布 2 个版本,首次发布于 2019/11/05;过去 12 个月发布了 0 个版本。

版本发布日期距今
3.1.0latest2019/12/016 年前
3.0.02019/11/057 年前

关于 @greenlock/manager 的常见问题

@greenlock/manager 是什么?

FileSytem-based Manager with optional encrypted Cloud backup for Greenlock SSL

如何安装 @greenlock/manager?

在项目目录运行 npm install @greenlock/manager,或使用 pnpm add / yarn add / bun add。

@greenlock/manager 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/greenlock__manager 是否存在。

@greenlock/manager 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@greenlock/manager 可以商用吗?

@greenlock/manager 使用 MPL-2.0 许可。弱 Copyleft:可以商用,也可以和闭源代码一起使用;但如果分发时修改了 MPL 授权的文件,这些文件的修改需以 MPL 开源。以上为概括,不构成法律意见,请以许可原文为准。

@greenlock/manager 的下载量有多少?

根据 npm 官方下载统计,@greenlock/manager 在 2026/10/17 – 2026/11/15 这 30 天内被下载 19,285 次,日均约 643 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@greenlock/manager 还在维护吗?

最新版本 3.1.0 发布于 2019/12/01(6 年前);至今共发布 2 个版本,其中过去 12 个月发布了 0 个;首次发布于 2019/11/05。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。