feat(kubernetes): add kubernetes tool (#1929)
Co-authored-by: oussama Dahmaz <dahmaz@MacBook-Pro-de-odahmaz.local>
This commit is contained in:
17
packages/api/src/middlewares/docker.ts
Normal file
17
packages/api/src/middlewares/docker.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { TRPCError } from "@trpc/server";
|
||||
|
||||
import { env } from "@homarr/docker/env";
|
||||
|
||||
import { publicProcedure } from "../trpc";
|
||||
|
||||
export const dockerMiddleware = () => {
|
||||
return publicProcedure.use(async ({ next }) => {
|
||||
if (env.ENABLE_DOCKER) {
|
||||
return await next();
|
||||
}
|
||||
throw new TRPCError({
|
||||
code: "NOT_FOUND",
|
||||
message: "Docker route is not available",
|
||||
});
|
||||
});
|
||||
};
|
||||
17
packages/api/src/middlewares/kubernetes.ts
Normal file
17
packages/api/src/middlewares/kubernetes.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { TRPCError } from "@trpc/server";
|
||||
|
||||
import { env } from "@homarr/docker/env";
|
||||
|
||||
import { publicProcedure } from "../trpc";
|
||||
|
||||
export const kubernetesMiddleware = () => {
|
||||
return publicProcedure.use(async ({ next }) => {
|
||||
if (env.ENABLE_KUBERNETES) {
|
||||
return await next();
|
||||
}
|
||||
throw new TRPCError({
|
||||
code: "NOT_FOUND",
|
||||
message: "Kubernetes route is not available",
|
||||
});
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user