From 32d94cbe97d7caae3102d8cb06cef726e68cd281 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 2 Jun 2022 11:13:27 +0200 Subject: [PATCH] fix: proxy stop missing argument --- src/routes/databases/[id]/delete.json.ts | 2 +- src/routes/databases/[id]/settings.json.ts | 2 +- src/routes/databases/[id]/stop.json.ts | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/routes/databases/[id]/delete.json.ts b/src/routes/databases/[id]/delete.json.ts index d731492ad..71c05130c 100644 --- a/src/routes/databases/[id]/delete.json.ts +++ b/src/routes/databases/[id]/delete.json.ts @@ -12,7 +12,7 @@ export const del: RequestHandler = async (event) => { const database = await db.getDatabase({ id, teamId }); if (database.destinationDockerId) { const everStarted = await stopDatabase(database); - if (everStarted) await stopTcpHttpProxy(database.destinationDocker, database.publicPort); + if (everStarted) await stopTcpHttpProxy(id, database.destinationDocker, database.publicPort); } await db.removeDatabase({ id }); return { status: 200 }; diff --git a/src/routes/databases/[id]/settings.json.ts b/src/routes/databases/[id]/settings.json.ts index e4263ce9a..1c2002890 100644 --- a/src/routes/databases/[id]/settings.json.ts +++ b/src/routes/databases/[id]/settings.json.ts @@ -29,7 +29,7 @@ export const post: RequestHandler = async (event) => { } } else { await db.prisma.database.update({ where: { id }, data: { publicPort: null } }); - await stopTcpHttpProxy(destinationDocker, oldPublicPort); + await stopTcpHttpProxy(id, destinationDocker, oldPublicPort); } } return { diff --git a/src/routes/databases/[id]/stop.json.ts b/src/routes/databases/[id]/stop.json.ts index 6bd4f4c19..15c5c6e41 100644 --- a/src/routes/databases/[id]/stop.json.ts +++ b/src/routes/databases/[id]/stop.json.ts @@ -13,7 +13,7 @@ export const post: RequestHandler = async (event) => { try { const database = await db.getDatabase({ id, teamId }); const everStarted = await stopDatabase(database); - if (everStarted) await stopTcpHttpProxy(database.destinationDocker, database.publicPort); + if (everStarted) await stopTcpHttpProxy(id, database.destinationDocker, database.publicPort); await db.setDatabase({ id, isPublic: false }); await db.prisma.database.update({ where: { id }, data: { publicPort: null } }); @@ -21,6 +21,7 @@ export const post: RequestHandler = async (event) => { status: 200 }; } catch (error) { + console.log(error); return ErrorHandler(error); } };