Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
1d8fb2b296 | |||
9d5f0d7a5d | |||
82b1d68576 | |||
e04b23aceb | |||
8e255938b5 | |||
f2eb9666a7 |
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartacme",
|
"name": "@pushrocks/smartacme",
|
||||||
"version": "2.0.33",
|
"version": "2.0.36",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartacme",
|
"name": "@pushrocks/smartacme",
|
||||||
"version": "2.0.33",
|
"version": "2.0.36",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "acme implementation in TypeScript",
|
"description": "acme implementation in TypeScript",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
|
@ -35,9 +35,9 @@ export class CertRemoteClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
)).body;
|
)).body;
|
||||||
console.log(responseBody);
|
|
||||||
switch (responseBody.status as interfaces.TCertStatus) {
|
switch (responseBody.status as interfaces.TCertStatus) {
|
||||||
case 'pending':
|
case 'pending':
|
||||||
|
this.logger.log('info', `request for ${domainNameArg} still pending!`);
|
||||||
await plugins.smartdelay.delayFor(5000);
|
await plugins.smartdelay.delayFor(5000);
|
||||||
const finalResponse = await doRequestCycle();
|
const finalResponse = await doRequestCycle();
|
||||||
return finalResponse;
|
return finalResponse;
|
||||||
|
@ -139,13 +139,28 @@ export class SmartAcme {
|
|||||||
await this.certmanager.smartdataDb.close();
|
await this.certmanager.smartdataDb.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gets a certificate
|
||||||
|
* it runs through the following steps
|
||||||
|
*
|
||||||
|
* * look in the database
|
||||||
|
* * if in the database return it
|
||||||
|
* * of not in the database announce it
|
||||||
|
* * then get it from letsencrypt
|
||||||
|
* * store it
|
||||||
|
* * remove it from the pending map (which it go onto by announcing it)
|
||||||
|
* * retrieve it from the databse and return it
|
||||||
|
*
|
||||||
|
* @param domainArg
|
||||||
|
*/
|
||||||
public async getCertificateForDomain(domainArg: string): Promise<Cert> {
|
public async getCertificateForDomain(domainArg: string): Promise<Cert> {
|
||||||
const certDomain = this.certmatcher.getCertificateDomainNameByDomainName(domainArg);
|
const certDomain = this.certmatcher.getCertificateDomainNameByDomainName(domainArg);
|
||||||
await this.certmanager.announceCertificate(certDomain);
|
|
||||||
const retrievedCertificate = await this.certmanager.retrieveCertificate(certDomain);
|
const retrievedCertificate = await this.certmanager.retrieveCertificate(certDomain);
|
||||||
|
|
||||||
if (retrievedCertificate) {
|
if (retrievedCertificate) {
|
||||||
return retrievedCertificate;
|
return retrievedCertificate;
|
||||||
|
} else {
|
||||||
|
await this.certmanager.announceCertificate(certDomain);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Place new order */
|
/* Place new order */
|
||||||
|
Reference in New Issue
Block a user