From 9e8ce2ba77b238bc07544e3bac495891738e2d07 Mon Sep 17 00:00:00 2001
From: Schulcz Ferenc <ferenc@hillfoot>
Date: Mon, 7 Apr 2025 13:41:49 +0000
Subject: [PATCH] Fix log message on IP update

---
 middleware/updateMW.js | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/middleware/updateMW.js b/middleware/updateMW.js
index f7c6b3f..31ca8af 100644
--- a/middleware/updateMW.js
+++ b/middleware/updateMW.js
@@ -47,6 +47,7 @@ module.exports = function () {
 				return;
 			})
 			.then((record) => {
+				const previousIP = record.ip;
 				db.updateDomain(record.name, token, ip).catch(() => {
 					res.locals.statuscode = 500;
 					res.locals.answer = { message: "Could not save in database." };
@@ -54,7 +55,7 @@ module.exports = function () {
 					return;
 				}).then(() => {
 					knotdns.updateRecord(record.name, ip).then(() => {
-						console.log("Updated record " + record.name + " from " + record.ip + " to " + ip);
+						console.log("Updated record " + record.name + " from " + previousIP + " to " + ip);
 						res.locals.statuscode = 200;
 						res.locals.answer = { message: "Updated." };
 						next();
@@ -64,4 +65,4 @@ module.exports = function () {
 			})
 
 	}
-}
\ No newline at end of file
+}
-- 
GitLab