@cloud-cli/le 1.2.0 → 1.2.1

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.
@@ -13,15 +13,18 @@ export class CertificateManager {
13
13
  return existsSync(join(certificatesFolder, domain));
14
14
  }
15
15
  createCertificate({ domain, domains, useWildcard, additionalOptions, update }) {
16
- if (!this.isValidDomain(domain)) {
17
- throw new Error('Invalid domain: ' + domain);
18
- }
19
16
  const path = join(certificatesFolder, domain);
20
17
  if (existsSync(path) && !update) {
21
18
  return true;
22
19
  }
23
- const $domains = domains ? domains.split(',') : [domain, useWildcard ? '*.' + domain : ''].filter(Boolean);
24
- const domainsWithPrefix = $domains.flatMap((domain) => ['-d', domain]);
20
+ const listOfDomains = domains ? domains.split(',').map(s => s.trim()) : [domain];
21
+ for (const d of listOfDomains) {
22
+ if (!this.isValidDomain(d)) {
23
+ throw new Error('Invalid domain: ' + d);
24
+ }
25
+ }
26
+ const domainsWithStar = !useWildcard ? listOfDomains : listOfDomains.flatMap(d => [d, '*.' + d]);
27
+ const domainsWithPrefix = domainsWithStar.flatMap((domain) => ['-d', domain]);
25
28
  const out = sh('certbot', ['certonly', ...(additionalOptions || []), ...domainsWithPrefix]);
26
29
  const stdout = String(out.stdout || '');
27
30
  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.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "LetsEncrypt integration for Cloudy",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",