From 0ff3f12f9a6d645f112a3d1aff887e3caea29a2e Mon Sep 17 00:00:00 2001 From: Wildan M Date: Wed, 15 Nov 2023 07:14:33 +0700 Subject: [PATCH] fix ssl mode and ability to disable lets encrypt --- package.json | 2 +- src/executor/runner.js | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index b6181c5..35ef6c0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "domcloud-bridge", - "version": "0.32.0", + "version": "0.32.1", "description": "Deployment runner for DOM Cloud", "main": "app.js", "engines": { diff --git a/src/executor/runner.js b/src/executor/runner.js index 5b91e19..a837f8a 100644 --- a/src/executor/runner.js +++ b/src/executor/runner.js @@ -669,7 +669,7 @@ export async function runConfigSubdomain(config, domaindata, subdomain, sshExec, let regenerateSsl = false; let expectedSslMode = null; if (['off', 'always', 'on'].includes(value)) { - expectedSslMode = expectedSslMode; + expectedSslMode = value; } else if (value == 'letsencrypt') { regenerateSsl = true; } @@ -703,13 +703,21 @@ export async function runConfigSubdomain(config, domaindata, subdomain, sshExec, await writeLog(await nginxExec.setDirect(subdomain, nginxInfos)); } if (regenerateSsl || (!expectedSslMode && !sharedSSL)) { - await writeLog("$> generating ssl cert with let's encrypt"); + await writeLog("$> Generating ssl cert with let's encrypt"); await spawnSudoUtil('OPENSSL_CLEAN'); await virtExec("generate-letsencrypt-cert", { domain: subdomain, 'renew': 2, 'web': true, }); + } else if (sharedSSL && domaindata['Lets Encrypt renewal'] == 'Enabled') { + await writeLog("$> Generating self signed cert and turning off let's encrypt renewal"); + await virtExec("generate-cert", { + domain: subdomain, + 'self': true, + }); + } else if (!changed) { + await writeLog("$> SSL config seems OK, nothing changed"); } break; case 'root':