From 298591af81f170f775148bf0254e3757fc1e66de Mon Sep 17 00:00:00 2001 From: Olli Vanhoja Date: Wed, 5 Oct 2016 20:15:49 +0300 Subject: [PATCH] now-alias: Renew expired cert automatically --- lib/alias.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/alias.js b/lib/alias.js index 0459ba3..ad67ca2 100644 --- a/lib/alias.js +++ b/lib/alias.js @@ -245,6 +245,16 @@ export default class Alias extends Now { return this.createAlias(depl, alias); } + if ('cert_expired' === code) { + console.log(`> Renewing certificate for ${chalk.underline(chalk.bold(alias))}`); + + try { + await this.createCert(alias, { renew: true }); + } catch (err) { + return bail(err); + } + } + return bail(new Error(body.error.message)); }