Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

commented out router

Daniel Hougaard706665e80187
diff --git a/backend/src/server/routes/v1/bdd-nock-router.ts b/backend/src/server/routes/v1/bdd-nock-router.ts
index 597d31d9ad..6a32cac20a 100644
--- a/backend/src/server/routes/v1/bdd-nock-router.ts
+++ b/backend/src/server/routes/v1/bdd-nock-router.ts
@@ -1,88 +1,87 @@
-import nock, { Definition } from "nock";
-import { z } from "zod";
+// import { z } from "zod";
-import { getConfig } from "@app/lib/config/env";
-import { ForbiddenRequestError } from "@app/lib/errors";
-import { logger } from "@app/lib/logger";
-import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
-import { AuthMode } from "@app/services/auth/auth-type";
+// import { getConfig } from "@app/lib/config/env";
+// import { ForbiddenRequestError } from "@app/lib/errors";
+// import { logger } from "@app/lib/logger";
+// import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
+// import { AuthMode } from "@app/services/auth/auth-type";
-export const registerBddNockRouter = async (server: FastifyZodProvider) => {
- const checkIfBddNockApiEnabled = () => {
- const appCfg = getConfig();
- // Note: Please note that this API is only available in development mode and only for BDD tests.
- // This endpoint should NEVER BE ENABLED IN PRODUCTION!
- if (appCfg.NODE_ENV !== "development" || !appCfg.isBddNockApiEnabled) {
- throw new ForbiddenRequestError({ message: "BDD Nock API is not enabled" });
- }
- };
+// export const registerBddNockRouter = async (server: FastifyZodProvider) => {
+// const checkIfBddNockApiEnabled = () => {
+// const appCfg = getConfig();
+// // Note: Please note that this API is only available in development mode and only for BDD tests.
+// // This endpoint should NEVER BE ENABLED IN PRODUCTION!
+// if (appCfg.NODE_ENV !== "development" || !appCfg.isBddNockApiEnabled) {
+// throw new ForbiddenRequestError({ message: "BDD Nock API is not enabled" });
+// }
+// };
- server.route({
- method: "POST",
- url: "/define",
- schema: {
- body: z.object({ definitions: z.unknown().array() }),
- response: {
- 200: z.object({ status: z.string() })
- }
- },
- onRequest: verifyAuth([AuthMode.JWT]),
- handler: async (req) => {
- checkIfBddNockApiEnabled();
- const { body } = req;
- const { definitions } = body;
- logger.info(definitions, "Defining nock");
- const processedDefinitions = definitions.map((definition: unknown) => {
- const { path, ...rest } = definition as Definition;
- return {
- ...rest,
- path:
- path !== undefined && typeof path === "string"
- ? path
- : new RegExp((path as unknown as { regex: string }).regex ?? "")
- } as Definition;
- });
+// server.route({
+// method: "POST",
+// url: "/define",
+// schema: {
+// body: z.object({ definitions: z.unknown().array() }),
+// response: {
+// 200: z.object({ status: z.string() })
+// }
+// },
+// onRequest: verifyAuth([AuthMode.JWT]),
+// handler: async (req) => {
+// checkIfBddNockApiEnabled();
+// const { body } = req;
+// const { definitions } = body;
+// logger.info(definitions, "Defining nock");
+// const processedDefinitions = definitions.map((definition: unknown) => {
+// const { path, ...rest } = definition as Definition;
+// return {
+// ...rest,
+// path:
+// path !== undefined && typeof path === "string"
+// ? path
+// : new RegExp((path as unknown as { regex: string }).regex ?? "")
+// } as Definition;
+// });
- nock.define(processedDefinitions);
- // Ensure we are activating the nocks, because we could have called `nock.restore()` before this call.
- if (!nock.isActive()) {
- nock.activate();
- }
- return { status: "ok" };
- }
- });
+// nock.define(processedDefinitions);
+// // Ensure we are activating the nocks, because we could have called `nock.restore()` before this call.
+// if (!nock.isActive()) {
+// nock.activate();
+// }
+// return { status: "ok" };
+// }
+// });
- server.route({
- method: "POST",
- url: "/clean-all",
- schema: {
- response: {
- 200: z.object({ status: z.string() })
- }
- },
- onRequest: verifyAuth([AuthMode.JWT]),
- handler: async () => {
- checkIfBddNockApiEnabled();
- logger.info("Cleaning all nocks");
- nock.cleanAll();
- return { status: "ok" };
- }
- });
+// server.route({
+// method: "POST",
+// url: "/clean-all",
+// schema: {
+// response: {
+// 200: z.object({ status: z.string() })
+// }
+// },
+// onRequest: verifyAuth([AuthMode.JWT]),
+// handler: async () => {
+// checkIfBddNockApiEnabled();
+// logger.info("Cleaning all nocks");
+// nock.cleanAll();
+// return { status: "ok" };
+// }
+// });
- server.route({
- method: "POST",
- url: "/restore",
- schema: {
- response: {
- 200: z.object({ status: z.string() })
- }
- },
- onRequest: verifyAuth([AuthMode.JWT]),
- handler: async () => {
- checkIfBddNockApiEnabled();
- logger.info("Restore network requests from nock");
- nock.restore();
- return { status: "ok" };
- }
- });
-};
+// server.route({
+// method: "POST",
+// url: "/restore",
+// schema: {
+// response: {
+// 200: z.object({ status: z.string() })
+// }
+// },
+// onRequest: verifyAuth([AuthMode.JWT]),
+// handler: async () => {
+// checkIfBddNockApiEnabled();
+// logger.info("Restore network requests from nock");
+// nock.restore();
+// return { status: "ok" };
+// }
+// });
+// };
diff --git a/backend/src/server/routes/v1/index.ts b/backend/src/server/routes/v1/index.ts
index 7fb8b1d0b0..68099e50e4 100644
--- a/backend/src/server/routes/v1/index.ts
+++ b/backend/src/server/routes/v1/index.ts
@@ -1,4 +1,3 @@
-import { getConfig } from "@app/lib/config/env";
import {
APP_CONNECTION_REGISTER_ROUTER_MAP,
registerAppConnectionRouter
@@ -9,7 +8,7 @@ import { registerSecretSyncRouter, SECRET_SYNC_REGISTER_ROUTER_MAP } from "@app/
import { registerAdminRouter } from "./admin-router";
import { registerAuthRoutes } from "./auth-router";
-import { registerBddNockRouter } from "./bdd-nock-router";
+// import { registerBddNockRouter } from "./bdd-nock-router";
import { registerProjectBotRouter } from "./bot-router";
import { registerCaRouter } from "./certificate-authority-router";
import { CERTIFICATE_AUTHORITY_REGISTER_ROUTER_MAP } from "./certificate-authority-routers";
@@ -242,7 +241,7 @@ export const registerV1Routes = async (server: FastifyZodProvider) => {
// Note: This is a special route for BDD tests. It's only available in development mode and only for BDD tests.
// This route should NEVER BE ENABLED IN PRODUCTION!
- if (getConfig().isBddNockApiEnabled) {
- await server.register(registerBddNockRouter, { prefix: "/bdd-nock" });
- }
+ // if (getConfig().isBddNockApiEnabled) {
+ // await server.register(registerBddNockRouter, { prefix: "/bdd-nock" });
+ // }
};