radash exists
All checks were successful
Build and deploy / deploy (push) Successful in 1m28s

This commit is contained in:
2025-05-01 17:55:23 +01:00
parent 681e645283
commit a4cce87950
3 changed files with 19 additions and 16 deletions

View File

@@ -2,6 +2,7 @@ import Docker from "dockerode";
import semver from "semver";
import { z } from "zod";
import { $ } from "zx";
import { sift } from "radash";
import { createTRPCRouter, publicProcedure } from "@/server/api/trpc";
import { TRPCError, type inferRouterOutputs } from "@trpc/server";
@@ -38,7 +39,7 @@ export const dockerRouter = createTRPCRouter({
const containers = await getContainers(docker);
// All this data should be local/from the local docker socket/api
let dockerInfo = await Promise.all(
let dockerInfo = sift(await Promise.all(
containers.map(async (container) => {
try {
if (!container.Id) {
@@ -74,9 +75,7 @@ export const dockerRouter = createTRPCRouter({
return null;
}
}),
);
dockerInfo = dockerInfo.filter((info) => !!info);
));
if (dockerInfo.length === 0) {
throw new TRPCError({