From 207dbb2f370f2dce854679d7c9b0eeb5fe14bb89 Mon Sep 17 00:00:00 2001 From: jbowring Date: Tue, 23 Jul 2024 08:39:18 +0100 Subject: [PATCH] Fix stream update not persisting --- backend/internal/stream.js | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/backend/internal/stream.js b/backend/internal/stream.js index b02ec967..6c9ab24d 100644 --- a/backend/internal/stream.js +++ b/backend/internal/stream.js @@ -34,9 +34,8 @@ const internalStream = { data.meta = {}; } - let data_no_domains = structuredClone(data); - // streams aren't routed by domain name so don't store domain names in the DB + let data_no_domains = structuredClone(data); delete data_no_domains.domain_names; return streamModel @@ -72,7 +71,7 @@ const internalStream = { // Configure nginx return internalNginx.configure(streamModel, 'stream', row) .then(() => { - return internalStream.get(access, {id: row.id, expand: ['owner']}); + return row; }); }) .then((row) => { @@ -139,12 +138,6 @@ const internalStream = { .query() .patchAndFetchById(row.id, data) .then(utils.omitRow(omissions())) - .then((saved_row) => { - return internalNginx.configure(streamModel, 'stream', saved_row) - .then(() => { - return internalStream.get(access, {id: row.id, expand: ['owner']}); - }); - }) .then((saved_row) => { // Add to audit log return internalAuditLog.add(access, { @@ -157,6 +150,17 @@ const internalStream = { return saved_row; }); }); + }) + .then(() => { + return internalStream.get(access, {id: data.id, expand: ['owner', 'certificate']}) + .then((row) => { + return internalNginx.configure(streamModel, 'stream', row) + .then((new_meta) => { + row.meta = new_meta; + row = internalHost.cleanRowCertificateMeta(row); + return _.omit(row, omissions()); + }); + }); }); },