Explorar el Código

Update the public key and the endpoint

Owen hace 4 meses
padre
commit
f99efbb1e9
Se han modificado 1 ficheros con 10 adiciones y 0 borrados
  1. 10 0
      server/routers/newt/handleGetConfigMessage.ts

+ 10 - 0
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`);
         logger.info(`Updated site ${siteId} with new WG Newt info`);
     } else {
     } 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;
         site = siteRes;
     }
     }