Skip to content

Commit c4496a9

Browse files
committed
use env variable in days instead of fixed 1 hour
1 parent 63d06da commit c4496a9

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

backend/internal/certificate.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,22 @@ function omissions() {
2929
const internalCertificate = {
3030

3131
allowedSslFiles: ['certificate', 'certificate_key', 'intermediate_certificate'],
32-
intervalTimeout: 1000 * 60 * 60, // 1 hour
32+
intervalTimeout: 86400 * 1000, // 1 day
3333
interval: null,
3434
intervalProcessing: false,
3535
renewBeforeExpirationBy: [30, 'days'],
3636

3737
initTimer: () => {
38-
logger.info('Let\'s Encrypt Renewal Timer initialized');
38+
let timerExecutedEvery = 1;
39+
if (typeof process.env.CERTIFICATE_RENEWAL_INTERVAL_IN_DAYS !== 'undefined') {
40+
internalCertificate.intervalTimeout = process.env.CERTIFICATE_RENEWAL_INTERVAL_IN_DAYS * 86400 * 1000;
41+
timerExecutedEvery = process.env.CERTIFICATE_RENEWAL_INTERVAL_IN_DAYS;
42+
}
43+
logger.info('Timer for certificates renewal will be executed every ' + timerExecutedEvery + ' day(s)');
3944
internalCertificate.interval = setInterval(internalCertificate.processExpiringHosts, internalCertificate.intervalTimeout);
4045
// And do this now as well
4146
internalCertificate.processExpiringHosts();
47+
logger.info('Let\'s Encrypt Renewal Timer initialized');
4248
},
4349

4450
/**

0 commit comments

Comments
 (0)