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(),
|
email: LetsEncryptNotificationEmail.toString(),
|
||||||
termsOfServiceAgreed: true,
|
termsOfServiceAgreed: true,
|
||||||
challengePriority: ['http-01'], // only http-01 challenge is supported by oneuptime
|
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
|
// Satisfy challenge here
|
||||||
/* http-01 */
|
/* http-01 */
|
||||||
if (challenge.type === '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
|
// Clean up challenge here
|
||||||
|
|
||||||
if (challenge.type === 'http-01') {
|
if (challenge.type === 'http-01') {
|
||||||
@ -160,7 +167,9 @@ export default class GreenlockUtil {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// get expires at date from certificate
|
// 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 issuedAt: Date = cert.notBefore;
|
||||||
const expiresAt: Date = cert.notAfter;
|
const expiresAt: Date = cert.notAfter;
|
||||||
|
|
||||||
|
@ -45,7 +45,6 @@ export default class Jobs {
|
|||||||
logger.error(err);
|
logger.error(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Write to disk.
|
// Write to disk.
|
||||||
await LocalFile.write(
|
await LocalFile.write(
|
||||||
`/etc/nginx/certs/StatusPageCerts/${cert.domain}.crt`,
|
`/etc/nginx/certs/StatusPageCerts/${cert.domain}.crt`,
|
||||||
|
Loading…
Reference in New Issue
Block a user