Applications

This commit is contained in:
2025-12-30 14:31:26 +01:00
parent c1eacf996d
commit fb05b455d5
6 changed files with 129 additions and 80 deletions
+20
View File
@@ -6,6 +6,9 @@ import fs from "fs/promises";
import path from "path";
import { exec } from "child_process";
import util from "util";
import { getNodes } from "./node";
import axios from "axios";
import { Application } from "@/lib/types";
const execAsync = util.promisify(exec);
@@ -70,3 +73,20 @@ export async function deployNewApp(name: string, repo: string, nodeId: string) {
image: imageTag,
};
}
export async function getApplications(): Promise<Application[]> {
const nodes = await getNodes();
return (
await Promise.all(
nodes.map(
async (n) =>
await (
await axios.get(`http://${n.ip}:3000/api/applications`, {
headers: { Authorization: `ApiKey ${n.key}` },
})
).data.applications
)
)
).flat();
}