mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 12:27:28 +00:00
Do not enable in production
This commit is contained in:
@@ -400,7 +400,7 @@ const envSchema = z
|
|||||||
isAcmeDevelopmentMode: data.NODE_ENV === "development" && data.ACME_DEVELOPMENT_MODE,
|
isAcmeDevelopmentMode: data.NODE_ENV === "development" && data.ACME_DEVELOPMENT_MODE,
|
||||||
isProductionMode: data.NODE_ENV === "production" || IS_PACKAGED,
|
isProductionMode: data.NODE_ENV === "production" || IS_PACKAGED,
|
||||||
isRedisSentinelMode: Boolean(data.REDIS_SENTINEL_HOSTS),
|
isRedisSentinelMode: Boolean(data.REDIS_SENTINEL_HOSTS),
|
||||||
isBddNockApiEnabled: data.NODE_ENV === "development" && data.BDD_NOCK_API_ENABLED,
|
isBddNockApiEnabled: data.NODE_ENV !== "production" && data.BDD_NOCK_API_ENABLED,
|
||||||
REDIS_SENTINEL_HOSTS: data.REDIS_SENTINEL_HOSTS?.trim()
|
REDIS_SENTINEL_HOSTS: data.REDIS_SENTINEL_HOSTS?.trim()
|
||||||
?.split(",")
|
?.split(",")
|
||||||
.map((el) => {
|
.map((el) => {
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ import { AuthMode } from "@app/services/auth/auth-type";
|
|||||||
// When running in production, we don't want to even import nock, because it's not needed and it increases memory usage a lots.
|
// When running in production, we don't want to even import nock, because it's not needed and it increases memory usage a lots.
|
||||||
// It once caused an outage in the production environment.
|
// It once caused an outage in the production environment.
|
||||||
// This is why we would rather to crash the app if it's not in development mode (in that case, Kubernetes should stop it from rolling out).
|
// This is why we would rather to crash the app if it's not in development mode (in that case, Kubernetes should stop it from rolling out).
|
||||||
if (process.env.NODE_ENV !== "development") {
|
if (process.env.NODE_ENV === "production") {
|
||||||
throw new Error("BDD Nock API is not enabled");
|
throw new Error("BDD Nock API can only be enabled in development or test mode");
|
||||||
}
|
}
|
||||||
|
|
||||||
export const registerBddNockRouter = async (server: FastifyZodProvider) => {
|
export const registerBddNockRouter = async (server: FastifyZodProvider) => {
|
||||||
@@ -24,7 +24,7 @@ export const registerBddNockRouter = async (server: FastifyZodProvider) => {
|
|||||||
const checkIfBddNockApiEnabled = () => {
|
const checkIfBddNockApiEnabled = () => {
|
||||||
// Note: Please note that this API is only available in development mode and only for BDD tests.
|
// 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!
|
// This endpoint should NEVER BE ENABLED IN PRODUCTION!
|
||||||
if (appCfg.NODE_ENV !== "development" || !appCfg.isBddNockApiEnabled) {
|
if (appCfg.NODE_ENV === "production" || !appCfg.isBddNockApiEnabled) {
|
||||||
throw new ForbiddenRequestError({ message: "BDD Nock API is not enabled" });
|
throw new ForbiddenRequestError({ message: "BDD Nock API is not enabled" });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user