mirror of
https://github.com/OneUptime/oneuptime
synced 2024-11-21 22:59:07 +00:00
Refactor GreenlockUtil challengeCreateFn and challengeRemoveFn to improve readability
This commit is contained in:
parent
2ba406f802
commit
78b7252743
@ -124,7 +124,11 @@ export default class GreenlockUtil {
|
||||
email: LetsEncryptNotificationEmail.toString(),
|
||||
termsOfServiceAgreed: true,
|
||||
challengePriority: ['http-01'], // only http-01 challenge is supported by oneuptime
|
||||
challengeCreateFn: async (authz: acme.Authorization, challenge: Challenge , keyAuthorization: string) => {
|
||||
challengeCreateFn: async (
|
||||
authz: acme.Authorization,
|
||||
challenge: Challenge,
|
||||
keyAuthorization: string
|
||||
) => {
|
||||
// Satisfy challenge here
|
||||
/* http-01 */
|
||||
if (challenge.type === 'http-01') {
|
||||
@ -141,7 +145,10 @@ export default class GreenlockUtil {
|
||||
});
|
||||
}
|
||||
},
|
||||
challengeRemoveFn: async (authz: acme.Authorization, challenge: Challenge) => {
|
||||
challengeRemoveFn: async (
|
||||
authz: acme.Authorization,
|
||||
challenge: Challenge
|
||||
) => {
|
||||
// Clean up challenge here
|
||||
|
||||
if (challenge.type === 'http-01') {
|
||||
@ -160,7 +167,9 @@ export default class GreenlockUtil {
|
||||
});
|
||||
|
||||
// get expires at date from certificate
|
||||
const cert: acme.CertificateInfo = await acme.forge.readCertificateInfo(certificate);
|
||||
const cert: acme.CertificateInfo = await acme.forge.readCertificateInfo(
|
||||
certificate
|
||||
);
|
||||
const issuedAt: Date = cert.notBefore;
|
||||
const expiresAt: Date = cert.notAfter;
|
||||
|
||||
|
@ -45,7 +45,6 @@ export default class Jobs {
|
||||
logger.error(err);
|
||||
}
|
||||
|
||||
|
||||
// Write to disk.
|
||||
await LocalFile.write(
|
||||
`/etc/nginx/certs/StatusPageCerts/${cert.domain}.crt`,
|
||||
|
Loading…
Reference in New Issue
Block a user