@cloud-cli/le 1.1.0 → 1.1.2
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 +15 -3
- package/dist/certificate-manager.d.ts +3 -3
- package/dist/certificate-manager.js +3 -3
- package/dist/index.d.ts +1 -2
- package/package.json +1 -1
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
|
-
**
|
|
14
|
+
**Update a certificate with domain example.com and all its subdomains**
|
|
15
15
|
|
|
16
16
|
```
|
|
17
|
-
cy le.add --domain example.com --useWildcard 1
|
|
17
|
+
cy le.add --domain example.com --useWildcard 1 --update
|
|
18
18
|
```
|
|
19
19
|
|
|
20
20
|
**Remove a certificate**
|
|
@@ -29,9 +29,21 @@ cy le.remove --domain example.com
|
|
|
29
29
|
cy le.exists --domain example.com
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
**List certificates
|
|
32
|
+
**List certificates by domains**
|
|
33
33
|
|
|
34
34
|
```
|
|
35
35
|
cy le.list
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
+
**Show certificate by domains**
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
cy le.show --domain example.com
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**Show certificate domains**
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
cy le.showDomains --domain example.com
|
|
48
|
+
```
|
|
49
|
+
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
export interface Certificate {
|
|
3
2
|
rootDomain: string;
|
|
4
3
|
certificate: string;
|
|
@@ -10,14 +9,15 @@ export interface CertificateOptions {
|
|
|
10
9
|
export interface CreateCertificateOptions extends CertificateOptions {
|
|
11
10
|
useWildcard: boolean;
|
|
12
11
|
additionalOptions?: string[];
|
|
12
|
+
update: boolean;
|
|
13
13
|
}
|
|
14
14
|
export declare class CertificateManager {
|
|
15
15
|
private readonly domainPattern;
|
|
16
16
|
certificateExists({ domain }: CertificateOptions): boolean;
|
|
17
|
-
createCertificate({ domain, useWildcard, additionalOptions }: CreateCertificateOptions): true | Promise<string>;
|
|
17
|
+
createCertificate({ domain, useWildcard, additionalOptions, update }: CreateCertificateOptions): true | Promise<string>;
|
|
18
18
|
removeCertificate({ domain }: CertificateOptions): boolean;
|
|
19
19
|
getCertificateList(): string[];
|
|
20
|
-
getCertificate({ domain }: CertificateOptions): Promise<
|
|
20
|
+
getCertificate({ domain }: CertificateOptions): Promise<string>;
|
|
21
21
|
getDomainsFromCert({ domain }: CertificateOptions): Promise<string[]>;
|
|
22
22
|
private isValidDomain;
|
|
23
23
|
}
|
|
@@ -12,12 +12,12 @@ export class CertificateManager {
|
|
|
12
12
|
}
|
|
13
13
|
return existsSync(join(certificatesFolder, domain));
|
|
14
14
|
}
|
|
15
|
-
createCertificate({ domain, useWildcard, additionalOptions }) {
|
|
15
|
+
createCertificate({ domain, useWildcard, additionalOptions, update }) {
|
|
16
16
|
if (!this.isValidDomain(domain)) {
|
|
17
17
|
throw new Error('Invalid domain: ' + domain);
|
|
18
18
|
}
|
|
19
19
|
const path = join(certificatesFolder, domain);
|
|
20
|
-
if (existsSync(path)) {
|
|
20
|
+
if (existsSync(path) && !update) {
|
|
21
21
|
return true;
|
|
22
22
|
}
|
|
23
23
|
const domains = [domain, useWildcard ? '*.' + domain : ''].filter(Boolean);
|
|
@@ -44,7 +44,7 @@ export class CertificateManager {
|
|
|
44
44
|
getCertificate({ domain }) {
|
|
45
45
|
const pemFile = join(certificatesFolder, domain, 'cert.pem');
|
|
46
46
|
const out = sh('openssl', ['x509', '-in', pemFile, '-noout', '-text']);
|
|
47
|
-
return out.status !== 0 ? Promise.resolve(out.stdout) : Promise.reject(out.stderr);
|
|
47
|
+
return out.status !== 0 ? Promise.resolve(String(out.stdout)) : Promise.reject(String(out.stderr));
|
|
48
48
|
}
|
|
49
49
|
async getDomainsFromCert({ domain }) {
|
|
50
50
|
const cert = await this.getCertificate({ domain });
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import { CertificateOptions, CreateCertificateOptions } from './certificate-manager.js';
|
|
3
2
|
declare const _default: {
|
|
4
3
|
add(certificate: CreateCertificateOptions): true | Promise<string>;
|
|
5
4
|
remove(options: CertificateOptions): boolean;
|
|
6
5
|
list(): string[];
|
|
7
6
|
exists(options: CertificateOptions): boolean;
|
|
8
|
-
show(options: CertificateOptions): Promise<
|
|
7
|
+
show(options: CertificateOptions): Promise<string>;
|
|
9
8
|
showDomains(options: CertificateOptions): Promise<string[]>;
|
|
10
9
|
};
|
|
11
10
|
export default _default;
|