Skip to content

Commit 638066a

Browse files
committed
fix: renew 28 days before expiration
1 parent 3f6aa13 commit 638066a

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@interactivetraining/acme-client",
3-
"version": "0.0.4",
3+
"version": "0.0.5",
44
"description": "Simple scalable automatic solution for obtaining SSL certificates.",
55
"keywords": [
66
"acme client",
@@ -12,7 +12,8 @@
1212
"main": "dist/index.js",
1313
"types": "dist/index.d.ts",
1414
"scripts": {
15-
"build": "tsc"
15+
"build": "tsc",
16+
"npmjs.publish": "npm publish --@interactivetraining:registry=https://registry.npmjs.org/ --access public"
1617
},
1718
"author": "Interactive Training (http://interactive.training)",
1819
"license": "MIT",

src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ export class AcmeClient {
2323
getCert(): Promise<{ key: string, cert: string }> {
2424
return new Promise(async (resolve1) => {
2525
const currentCert = await this.gCloudStorage.read('cert');
26-
if (!currentCert || !(currentCert && (new Date().getTime() - (letiny.getExpirationDate(currentCert) as Date).getTime()) / (1000 * 60 * 60 * 24.0))) {
26+
27+
if (!currentCert || (currentCert && (new Date().getTime() + (60 * 60 * 24 * 28)) >= (letiny.getExpirationDate(currentCert) as Date).getTime())) {
2728
letiny.getCert({
2829
method: 'dns-01',
2930
email: this.config.email,

0 commit comments

Comments
 (0)