mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
feat: maintaince mode enable machine identity login and renew
This commit is contained in:
@@ -5,8 +5,13 @@ import { getConfig } from "@app/lib/config/env";
|
|||||||
export const maintenanceMode = fp(async (fastify) => {
|
export const maintenanceMode = fp(async (fastify) => {
|
||||||
fastify.addHook("onRequest", async (req) => {
|
fastify.addHook("onRequest", async (req) => {
|
||||||
const serverEnvs = getConfig();
|
const serverEnvs = getConfig();
|
||||||
if (req.url !== "/api/v1/auth/checkAuth" && req.method !== "GET" && serverEnvs.MAINTENANCE_MODE) {
|
if (serverEnvs.MAINTENANCE_MODE) {
|
||||||
throw new Error("Infisical is in maintenance mode. Please try again later.");
|
// skip if its universal auth login or renew
|
||||||
|
if (req.url === "/api/v1/auth/universal-auth/login" && req.method === "POST") return;
|
||||||
|
if (req.url === "/api/v1/auth/token/renew" && req.method === "POST") return;
|
||||||
|
if (req.url !== "/api/v1/auth/checkAuth" && req.method !== "GET") {
|
||||||
|
throw new Error("Infisical is in maintenance mode. Please try again later.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user