WIP: Remote docker engine

This commit is contained in:
Andras Bacsai
2022-02-26 15:08:26 +01:00
parent c9b52f1310
commit e0e50b4bd5
12 changed files with 456 additions and 60 deletions

View File

@@ -8,10 +8,36 @@ export const post: RequestHandler = async (event) => {
const { teamId, status, body } = await getUserDetails(event);
if (status === 401) return { status, body };
const { name, engine, network, isCoolifyProxyUsed } = await event.request.json();
const {
name,
engine,
network,
isCoolifyProxyUsed,
remoteEngine,
ipAddress,
user,
port,
sshPrivateKey
} = await event.request.json();
try {
const id = await db.newDestination({ name, teamId, engine, network, isCoolifyProxyUsed });
let id = null;
if (remoteEngine) {
id = await db.newRemoteDestination({
name,
teamId,
engine,
network,
isCoolifyProxyUsed,
remoteEngine,
ipAddress,
user,
port,
sshPrivateKey
});
} else {
id = await db.newLocalDestination({ name, teamId, engine, network, isCoolifyProxyUsed });
}
return { status: 200, body: { id } };
} catch (error) {
return ErrorHandler(error);