浏览代码

Update the public key and the endpoint

Owen 5 月之前
父节点
当前提交
f99efbb1e9
共有 1 个文件被更改,包括 10 次插入0 次删除
  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`);
     } 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;
     }