fix(core): update

This commit is contained in:
2019-01-13 02:10:00 +01:00
parent c3fd8750b2
commit f9db3d28fe
6 changed files with 30 additions and 6 deletions

View File

@ -1,6 +1,7 @@
import * as plugins from './smartacme.plugins';
import { Cert } from './smartacme.classes.cert';
import { CertManager } from './smartacme.classes.certmanager';
import { CertMatcher } from './smartacme.classes.certmatcher';
import * as interfaces from './interfaces';
import { request } from 'http';
@ -44,6 +45,7 @@ export class SmartAcme {
// certmanager
private certmanager: CertManager;
private certmatcher: CertMatcher;
private certremoteHandler: plugins.smartexpress.Handler;
constructor(optionsArg: ISmartAcmeOptions) {
@ -68,6 +70,9 @@ export class SmartAcme {
});
await this.certmanager.init();
// CertMatcher
this.certmatcher = new CertMatcher();
// CertRemoteHandler
this.certremoteHandler = new plugins.smartexpress.Handler('POST', async (req, res) => {
const requestBody: interfaces.ICertRemoteRequest = req.body;
@ -118,7 +123,7 @@ export class SmartAcme {
}
public async getCertificateForDomain(domainArg: string): Promise<Cert> {
const domain = domainArg;
const domain = this.certmatcher.getCertificateDomainNameByDomainName(domainArg);
const retrievedCertificate = await this.certmanager.retrieveCertificate(domain);