From f99efbb1e90110b5dda131a9b4a7a4e082418677 Mon Sep 17 00:00:00 2001 From: Owen Date: Fri, 21 Feb 2025 17:23:22 -0500 Subject: [PATCH] Update the public key and the endpoint --- server/routers/newt/handleGetConfigMessage.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/server/routers/newt/handleGetConfigMessage.ts b/server/routers/newt/handleGetConfigMessage.ts index 7226ce2..be460ab 100644 --- a/server/routers/newt/handleGetConfigMessage.ts +++ b/server/routers/newt/handleGetConfigMessage.ts @@ -78,6 +78,16 @@ export const handleGetConfigMessage: MessageHandler = async (context) => { logger.info(`Updated site ${siteId} with new WG Newt info`); } else { + // update the endpoint and the public key + const [siteRes] = await db + .update(sites) + .set({ + publicKey, + endpoint + }) + .where(eq(sites.siteId, siteId)) + .returning(); + site = siteRes; }