@cloud-cli/le 1.1.4 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -11,10 +11,10 @@ Requires `certbot` to be installed on server and properly configured for Let's E
11
11
  cy le.add --domain example.com
12
12
  ```
13
13
 
14
- **Update a certificate with domain example.com and all its subdomains**
14
+ **Update a certificate with domain example.com and subdomains**
15
15
 
16
16
  ```
17
- cy le.add --domain example.com --useWildcard 1 --update
17
+ cy le.add --domains example.com,foo.example.com --useWildcard true --update
18
18
  ```
19
19
 
20
20
  **Remove a certificate**
@@ -5,6 +5,7 @@ export interface Certificate {
5
5
  }
6
6
  export interface CertificateOptions {
7
7
  domain: string;
8
+ domains?: string;
8
9
  }
9
10
  export interface CreateCertificateOptions extends CertificateOptions {
10
11
  useWildcard: boolean;
@@ -14,7 +15,7 @@ export interface CreateCertificateOptions extends CertificateOptions {
14
15
  export declare class CertificateManager {
15
16
  private readonly domainPattern;
16
17
  certificateExists({ domain }: CertificateOptions): boolean;
17
- createCertificate({ domain, useWildcard, additionalOptions, update }: CreateCertificateOptions): true | Promise<string>;
18
+ createCertificate({ domain, domains, useWildcard, additionalOptions, update }: CreateCertificateOptions): true | Promise<string>;
18
19
  removeCertificate({ domain }: CertificateOptions): boolean;
19
20
  getCertificateList(): string[];
20
21
  getCertificate({ domain }: CertificateOptions): Promise<string>;
@@ -12,7 +12,7 @@ export class CertificateManager {
12
12
  }
13
13
  return existsSync(join(certificatesFolder, domain));
14
14
  }
15
- createCertificate({ domain, useWildcard, additionalOptions, update }) {
15
+ createCertificate({ domain, domains, useWildcard, additionalOptions, update }) {
16
16
  if (!this.isValidDomain(domain)) {
17
17
  throw new Error('Invalid domain: ' + domain);
18
18
  }
@@ -20,8 +20,8 @@ export class CertificateManager {
20
20
  if (existsSync(path) && !update) {
21
21
  return true;
22
22
  }
23
- const domains = [domain, useWildcard ? '*.' + domain : ''].filter(Boolean);
24
- const domainsWithPrefix = domains.flatMap((domain) => ['-d', domain]);
23
+ const $domains = domains ? domains.split(',') : [domain, useWildcard ? '*.' + domain : ''].filter(Boolean);
24
+ const domainsWithPrefix = $domains.flatMap((domain) => ['-d', domain]);
25
25
  const out = sh('certbot', ['certonly', ...(additionalOptions || []), ...domainsWithPrefix]);
26
26
  const stdout = String(out.stdout || '');
27
27
  const stderr = String(out.stderr || '').split('\n').map(s => '! ' + s).join('\n');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloud-cli/le",
3
- "version": "1.1.4",
3
+ "version": "1.2.0",
4
4
  "description": "LetsEncrypt integration for Cloudy",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",