mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 15:27:46 +00:00
Fix: e2e tests
This commit is contained in:
Vendored
-5
@@ -1,5 +0,0 @@
|
|||||||
declare namespace NodeJS {
|
|
||||||
interface Process {
|
|
||||||
pkg?: boolean;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -5,6 +5,9 @@ import { zpStr } from "../zod";
|
|||||||
|
|
||||||
export const GITLAB_URL = "https://gitlab.com";
|
export const GITLAB_URL = "https://gitlab.com";
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any -- If `process.pkg` is set, and it's true, then it means that the app is currently running in a packaged environment (a binary)
|
||||||
|
export const IS_PACKAGED = (process as any)?.pkg === true;
|
||||||
|
|
||||||
const zodStrBool = z
|
const zodStrBool = z
|
||||||
.enum(["true", "false"])
|
.enum(["true", "false"])
|
||||||
.optional()
|
.optional()
|
||||||
@@ -20,7 +23,7 @@ const databaseReadReplicaSchema = z
|
|||||||
|
|
||||||
const envSchema = z
|
const envSchema = z
|
||||||
.object({
|
.object({
|
||||||
PORT: z.coerce.number().default(process?.pkg ? 8080 : 4000),
|
PORT: z.coerce.number().default(IS_PACKAGED ? 8080 : 4000),
|
||||||
DISABLE_SECRET_SCANNING: z
|
DISABLE_SECRET_SCANNING: z
|
||||||
.enum(["true", "false"])
|
.enum(["true", "false"])
|
||||||
.default("false")
|
.default("false")
|
||||||
@@ -131,7 +134,7 @@ const envSchema = z
|
|||||||
// GENERIC
|
// GENERIC
|
||||||
STANDALONE_MODE: z
|
STANDALONE_MODE: z
|
||||||
.enum(["true", "false"])
|
.enum(["true", "false"])
|
||||||
.transform((val) => val === "true" || process?.pkg === true)
|
.transform((val) => val === "true" || IS_PACKAGED)
|
||||||
.optional(),
|
.optional(),
|
||||||
INFISICAL_CLOUD: zodStrBool.default("false"),
|
INFISICAL_CLOUD: zodStrBool.default("false"),
|
||||||
MAINTENANCE_MODE: zodStrBool.default("false"),
|
MAINTENANCE_MODE: zodStrBool.default("false"),
|
||||||
@@ -148,7 +151,7 @@ const envSchema = z
|
|||||||
isSmtpConfigured: Boolean(data.SMTP_HOST),
|
isSmtpConfigured: Boolean(data.SMTP_HOST),
|
||||||
isRedisConfigured: Boolean(data.REDIS_URL),
|
isRedisConfigured: Boolean(data.REDIS_URL),
|
||||||
isDevelopmentMode: data.NODE_ENV === "development",
|
isDevelopmentMode: data.NODE_ENV === "development",
|
||||||
isProductionMode: data.NODE_ENV === "production" || process?.pkg === true,
|
isProductionMode: data.NODE_ENV === "production" || IS_PACKAGED,
|
||||||
isSecretScanningConfigured:
|
isSecretScanningConfigured:
|
||||||
Boolean(data.SECRET_SCANNING_GIT_APP_ID) &&
|
Boolean(data.SECRET_SCANNING_GIT_APP_ID) &&
|
||||||
Boolean(data.SECRET_SCANNING_PRIVATE_KEY) &&
|
Boolean(data.SECRET_SCANNING_PRIVATE_KEY) &&
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import { Knex } from "knex";
|
|||||||
import { Logger } from "pino";
|
import { Logger } from "pino";
|
||||||
|
|
||||||
import { TKeyStoreFactory } from "@app/keystore/keystore";
|
import { TKeyStoreFactory } from "@app/keystore/keystore";
|
||||||
import { getConfig } from "@app/lib/config/env";
|
import { getConfig, IS_PACKAGED } from "@app/lib/config/env";
|
||||||
import { TQueueServiceFactory } from "@app/queue";
|
import { TQueueServiceFactory } from "@app/queue";
|
||||||
import { TSmtpService } from "@app/services/smtp/smtp-service";
|
import { TSmtpService } from "@app/services/smtp/smtp-service";
|
||||||
|
|
||||||
@@ -80,8 +80,8 @@ export const main = async ({ db, smtp, logger, queue, keyStore }: TMain) => {
|
|||||||
|
|
||||||
if (appCfg.isProductionMode) {
|
if (appCfg.isProductionMode) {
|
||||||
await server.register(registerExternalNextjs, {
|
await server.register(registerExternalNextjs, {
|
||||||
standaloneMode: appCfg.STANDALONE_MODE || process?.pkg,
|
standaloneMode: appCfg.STANDALONE_MODE,
|
||||||
dir: path.join(__dirname, process?.pkg ? "../../../" : "../../"),
|
dir: path.join(__dirname, IS_PACKAGED ? "../../../" : "../../"),
|
||||||
port: appCfg.PORT
|
port: appCfg.PORT
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
// this plugins allows to run infisical in standalone mode
|
// this plugins allows to run infisical in standalone mode
|
||||||
// standalone mode = infisical backend and nextjs frontend in one server
|
// standalone mode = infisical backend and nextjs frontend in one server
|
||||||
// this way users don't need to deploy two things
|
// this way users don't need to deploy two things
|
||||||
|
|
||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
|
|
||||||
|
import { IS_PACKAGED } from "@app/lib/config/env";
|
||||||
|
|
||||||
// to enabled this u need to set standalone mode to true
|
// to enabled this u need to set standalone mode to true
|
||||||
export const registerExternalNextjs = async (
|
export const registerExternalNextjs = async (
|
||||||
server: FastifyZodProvider,
|
server: FastifyZodProvider,
|
||||||
@@ -18,7 +19,7 @@ export const registerExternalNextjs = async (
|
|||||||
}
|
}
|
||||||
) => {
|
) => {
|
||||||
if (standaloneMode) {
|
if (standaloneMode) {
|
||||||
const frontendName = process?.pkg ? "frontend" : "frontend-build";
|
const frontendName = IS_PACKAGED ? "frontend" : "frontend-build";
|
||||||
|
|
||||||
const nextJsBuildPath = path.join(dir, frontendName);
|
const nextJsBuildPath = path.join(dir, frontendName);
|
||||||
|
|
||||||
@@ -33,7 +34,7 @@ export const registerExternalNextjs = async (
|
|||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
let NextServer: any;
|
let NextServer: any;
|
||||||
|
|
||||||
if (!process?.pkg) {
|
if (!IS_PACKAGED) {
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
const { default: nextServer } = (
|
const { default: nextServer } = (
|
||||||
await import(path.join(dir, `${frontendName}/node_modules/next/dist/server/next-server.js`))
|
await import(path.join(dir, `${frontendName}/node_modules/next/dist/server/next-server.js`))
|
||||||
|
|||||||
Reference in New Issue
Block a user