Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
feat: adds app connection for laravel forge
Piyush Guptad260e40a3b16
diff --git a/backend/src/lib/api-docs/constants.ts b/backend/src/lib/api-docs/constants.tsindex 2d0de59a2c..269b283ddf 100644--- a/backend/src/lib/api-docs/constants.ts+++ b/backend/src/lib/api-docs/constants.ts@@ -2355,6 +2355,9 @@ export const AppConnections = {sslRejectUnauthorized:"Whether or not to reject unauthorized SSL certificates (true/false). Set to false only in test environments with self-signed certificates.",sslCertificate: "The SSL certificate (PEM format) to use for secure connection."+ },+ LARAVEL_FORGE: {+ apiToken: "The API token used to authenticate with Laravel Forge."}}};diff --git a/backend/src/server/routes/v1/app-connection-routers/app-connection-router.ts b/backend/src/server/routes/v1/app-connection-routers/app-connection-router.tsindex e5549f9fe0..c799ef0f04 100644--- a/backend/src/server/routes/v1/app-connection-routers/app-connection-router.ts+++ b/backend/src/server/routes/v1/app-connection-routers/app-connection-router.ts@@ -77,6 +77,10 @@ import {HumanitecConnectionListItemSchema,SanitizedHumanitecConnectionSchema} from "@app/services/app-connection/humanitec";+import {+ LaravelForgeConnectionListItemSchema,+ SanitizedLaravelForgeConnectionSchema+} from "@app/services/app-connection/laravel-forge";import { LdapConnectionListItemSchema, SanitizedLdapConnectionSchema } from "@app/services/app-connection/ldap";import { MsSqlConnectionListItemSchema, SanitizedMsSqlConnectionSchema } from "@app/services/app-connection/mssql";import { MySqlConnectionListItemSchema, SanitizedMySqlConnectionSchema } from "@app/services/app-connection/mysql";@@ -158,7 +162,8 @@ const SanitizedAppConnectionSchema = z.union([...SanitizedNetlifyConnectionSchema.options,...SanitizedOktaConnectionSchema.options,...SanitizedAzureADCSConnectionSchema.options,- ...SanitizedRedisConnectionSchema.options+ ...SanitizedRedisConnectionSchema.options,+ ...SanitizedLaravelForgeConnectionSchema.options]);const AppConnectionOptionsSchema = z.discriminatedUnion("app", [@@ -200,7 +205,8 @@ const AppConnectionOptionsSchema = z.discriminatedUnion("app", [NetlifyConnectionListItemSchema,OktaConnectionListItemSchema,AzureADCSConnectionListItemSchema,- RedisConnectionListItemSchema+ RedisConnectionListItemSchema,+ LaravelForgeConnectionListItemSchema]);export const registerAppConnectionRouter = async (server: FastifyZodProvider) => {diff --git a/backend/src/server/routes/v1/app-connection-routers/index.ts b/backend/src/server/routes/v1/app-connection-routers/index.tsindex 11d9ce5e63..2e3da44206 100644--- a/backend/src/server/routes/v1/app-connection-routers/index.ts+++ b/backend/src/server/routes/v1/app-connection-routers/index.ts@@ -24,6 +24,7 @@ import { registerGitLabConnectionRouter } from "./gitlab-connection-router";import { registerHCVaultConnectionRouter } from "./hc-vault-connection-router";import { registerHerokuConnectionRouter } from "./heroku-connection-router";import { registerHumanitecConnectionRouter } from "./humanitec-connection-router";+import { registerLaravelForgeConnectionRouter } from "./laravel-forge-connection-router";import { registerLdapConnectionRouter } from "./ldap-connection-router";import { registerMsSqlConnectionRouter } from "./mssql-connection-router";import { registerMySqlConnectionRouter } from "./mysql-connection-router";@@ -71,6 +72,7 @@ export const APP_CONNECTION_REGISTER_ROUTER_MAP: Record<AppConnection, (server:[AppConnection.OnePass]: registerOnePassConnectionRouter,[AppConnection.Heroku]: registerHerokuConnectionRouter,[AppConnection.Render]: registerRenderConnectionRouter,+ [AppConnection.LaravelForge]: registerLaravelForgeConnectionRouter,[AppConnection.Flyio]: registerFlyioConnectionRouter,[AppConnection.GitLab]: registerGitLabConnectionRouter,[AppConnection.Cloudflare]: registerCloudflareConnectionRouter,diff --git a/backend/src/server/routes/v1/app-connection-routers/laravel-forge-connection-router.ts b/backend/src/server/routes/v1/app-connection-routers/laravel-forge-connection-router.tsnew file mode 100644index 0000000000..ede855677b--- /dev/null+++ b/backend/src/server/routes/v1/app-connection-routers/laravel-forge-connection-router.ts@@ -0,0 +1,18 @@+import { AppConnection } from "@app/services/app-connection/app-connection-enums";+import {+ CreateLaravelForgeConnectionSchema,+ SanitizedLaravelForgeConnectionSchema,+ UpdateLaravelForgeConnectionSchema+} from "@app/services/app-connection/laravel-forge";++import { registerAppConnectionEndpoints } from "./app-connection-endpoints";++export const registerLaravelForgeConnectionRouter = async (server: FastifyZodProvider) => {+ registerAppConnectionEndpoints({+ app: AppConnection.LaravelForge,+ server,+ sanitizedResponseSchema: SanitizedLaravelForgeConnectionSchema,+ createSchema: CreateLaravelForgeConnectionSchema,+ updateSchema: UpdateLaravelForgeConnectionSchema+ });+};diff --git a/backend/src/services/app-connection/app-connection-enums.ts b/backend/src/services/app-connection/app-connection-enums.tsindex 996cd872a1..54b70c7d3a 100644--- a/backend/src/services/app-connection/app-connection-enums.ts+++ b/backend/src/services/app-connection/app-connection-enums.ts@@ -37,7 +37,8 @@ export enum AppConnection {DigitalOcean = "digital-ocean",Netlify = "netlify",Okta = "okta",- Redis = "redis"+ Redis = "redis",+ LaravelForge = "laravel-forge"}export enum AWSRegion {diff --git a/backend/src/services/app-connection/app-connection-fns.ts b/backend/src/services/app-connection/app-connection-fns.tsindex 73abef78dd..464f718cea 100644--- a/backend/src/services/app-connection/app-connection-fns.ts+++ b/backend/src/services/app-connection/app-connection-fns.ts@@ -103,6 +103,11 @@ import {HumanitecConnectionMethod,validateHumanitecConnectionCredentials} from "./humanitec";+import {+ getLaravelForgeConnectionListItem,+ LaravelForgeConnectionMethod,+ validateLaravelForgeConnectionCredentials+} from "./laravel-forge";import { getLdapConnectionListItem, LdapConnectionMethod, validateLdapConnectionCredentials } from "./ldap";import { getMsSqlConnectionListItem, MsSqlConnectionMethod } from "./mssql";import { MySqlConnectionMethod } from "./mysql/mysql-connection-enums";@@ -187,6 +192,7 @@ export const listAppConnectionOptions = (projectType?: ProjectType) => {getOnePassConnectionListItem(),getHerokuConnectionListItem(),getRenderConnectionListItem(),+ getLaravelForgeConnectionListItem(),getFlyioConnectionListItem(),getGitLabConnectionListItem(),getCloudflareConnectionListItem(),@@ -316,6 +322,7 @@ export const validateAppConnectionCredentials = async ([AppConnection.OnePass]: validateOnePassConnectionCredentials as TAppConnectionCredentialsValidator,[AppConnection.Heroku]: validateHerokuConnectionCredentials as TAppConnectionCredentialsValidator,[AppConnection.Render]: validateRenderConnectionCredentials as TAppConnectionCredentialsValidator,+ [AppConnection.LaravelForge]: validateLaravelForgeConnectionCredentials as TAppConnectionCredentialsValidator,[AppConnection.Flyio]: validateFlyioConnectionCredentials as TAppConnectionCredentialsValidator,[AppConnection.GitLab]: validateGitLabConnectionCredentials as TAppConnectionCredentialsValidator,[AppConnection.Cloudflare]: validateCloudflareConnectionCredentials as TAppConnectionCredentialsValidator,@@ -368,6 +375,7 @@ export const getAppConnectionMethodName = (method: TAppConnection["method"]) =>case ZabbixConnectionMethod.ApiToken:case DigitalOceanConnectionMethod.ApiToken:case OktaConnectionMethod.ApiToken:+ case LaravelForgeConnectionMethod.ApiToken:return "API Token";case PostgresConnectionMethod.UsernameAndPassword:case MsSqlConnectionMethod.UsernameAndPassword:@@ -463,7 +471,8 @@ export const TRANSITION_CONNECTION_CREDENTIALS_TO_PLATFORM: Record<[AppConnection.DigitalOcean]: platformManagedCredentialsNotSupported,[AppConnection.Netlify]: platformManagedCredentialsNotSupported,[AppConnection.Okta]: platformManagedCredentialsNotSupported,- [AppConnection.Redis]: platformManagedCredentialsNotSupported+ [AppConnection.Redis]: platformManagedCredentialsNotSupported,+ [AppConnection.LaravelForge]: platformManagedCredentialsNotSupported};export const enterpriseAppCheck = async (diff --git a/backend/src/services/app-connection/app-connection-maps.ts b/backend/src/services/app-connection/app-connection-maps.tsindex e3235d2f71..c01d9d1b4a 100644--- a/backend/src/services/app-connection/app-connection-maps.ts+++ b/backend/src/services/app-connection/app-connection-maps.ts@@ -28,6 +28,7 @@ export const APP_CONNECTION_NAME_MAP: Record<AppConnection, string> = {[AppConnection.OnePass]: "1Password",[AppConnection.Heroku]: "Heroku",[AppConnection.Render]: "Render",+ [AppConnection.LaravelForge]: "Laravel Forge",[AppConnection.Flyio]: "Fly.io",[AppConnection.GitLab]: "GitLab",[AppConnection.Cloudflare]: "Cloudflare",@@ -70,6 +71,7 @@ export const APP_CONNECTION_PLAN_MAP: Record<AppConnection, AppConnectionPlanTyp[AppConnection.MySql]: AppConnectionPlanType.Regular,[AppConnection.Heroku]: AppConnectionPlanType.Regular,[AppConnection.Render]: AppConnectionPlanType.Regular,+ [AppConnection.LaravelForge]: AppConnectionPlanType.Regular,[AppConnection.Flyio]: AppConnectionPlanType.Regular,[AppConnection.GitLab]: AppConnectionPlanType.Regular,[AppConnection.Cloudflare]: AppConnectionPlanType.Regular,diff --git a/backend/src/services/app-connection/app-connection-service.ts b/backend/src/services/app-connection/app-connection-service.tsindex dbfaf2e835..5e26ebdaf9 100644--- a/backend/src/services/app-connection/app-connection-service.ts+++ b/backend/src/services/app-connection/app-connection-service.ts@@ -89,6 +89,8 @@ import { ValidateHerokuConnectionCredentialsSchema } from "./heroku";import { herokuConnectionService } from "./heroku/heroku-connection-service";import { ValidateHumanitecConnectionCredentialsSchema } from "./humanitec";import { humanitecConnectionService } from "./humanitec/humanitec-connection-service";+import { ValidateLaravelForgeConnectionCredentialsSchema } from "./laravel-forge";+import { laravelForgeConnectionService } from "./laravel-forge/laravel-forge-connection-service";import { ValidateLdapConnectionCredentialsSchema } from "./ldap";import { ValidateMsSqlConnectionCredentialsSchema } from "./mssql";import { ValidateMySqlConnectionCredentialsSchema } from "./mysql";@@ -157,6 +159,7 @@ const VALIDATE_APP_CONNECTION_CREDENTIALS_MAP: Record<AppConnection, TValidateAp[AppConnection.OnePass]: ValidateOnePassConnectionCredentialsSchema,[AppConnection.Heroku]: ValidateHerokuConnectionCredentialsSchema,[AppConnection.Render]: ValidateRenderConnectionCredentialsSchema,+ [AppConnection.LaravelForge]: ValidateLaravelForgeConnectionCredentialsSchema,[AppConnection.Flyio]: ValidateFlyioConnectionCredentialsSchema,[AppConnection.GitLab]: ValidateGitLabConnectionCredentialsSchema,[AppConnection.Cloudflare]: ValidateCloudflareConnectionCredentialsSchema,@@ -864,6 +867,7 @@ export const appConnectionServiceFactory = ({supabase: supabaseConnectionService(connectAppConnectionById),digitalOcean: digitalOceanAppPlatformConnectionService(connectAppConnectionById),netlify: netlifyConnectionService(connectAppConnectionById),- okta: oktaConnectionService(connectAppConnectionById)+ okta: oktaConnectionService(connectAppConnectionById),+ laravelForge: laravelForgeConnectionService(connectAppConnectionById)};};diff --git a/backend/src/services/app-connection/app-connection-types.ts b/backend/src/services/app-connection/app-connection-types.tsindex cf6f45f6c5..739b4924e7 100644--- a/backend/src/services/app-connection/app-connection-types.ts+++ b/backend/src/services/app-connection/app-connection-types.ts@@ -148,6 +148,12 @@ import {THumanitecConnectionInput,TValidateHumanitecConnectionCredentialsSchema} from "./humanitec";+import {+ TLaravelForgeConnection,+ TLaravelForgeConnectionConfig,+ TLaravelForgeConnectionInput,+ TValidateLaravelForgeConnectionCredentialsSchema+} from "./laravel-forge";import {TLdapConnection,TLdapConnectionConfig,@@ -256,6 +262,7 @@ export type TAppConnection = { id: string } & (| TOnePassConnection| THerokuConnection| TRenderConnection+ | TLaravelForgeConnection| TFlyioConnection| TGitLabConnection| TCloudflareConnection@@ -302,6 +309,7 @@ export type TAppConnectionInput = { id: string } & (| TOnePassConnectionInput| THerokuConnectionInput| TRenderConnectionInput+ | TLaravelForgeConnectionInput| TFlyioConnectionInput| TGitLabConnectionInput| TCloudflareConnectionInput@@ -366,6 +374,7 @@ export type TAppConnectionConfig =| TOnePassConnectionConfig| THerokuConnectionConfig| TRenderConnectionConfig+ | TLaravelForgeConnectionConfig| TFlyioConnectionConfig| TGitLabConnectionConfig| TCloudflareConnectionConfig@@ -407,6 +416,7 @@ export type TValidateAppConnectionCredentialsSchema =| TValidateOnePassConnectionCredentialsSchema| TValidateHerokuConnectionCredentialsSchema| TValidateRenderConnectionCredentialsSchema+ | TValidateLaravelForgeConnectionCredentialsSchema| TValidateFlyioConnectionCredentialsSchema| TValidateGitLabConnectionCredentialsSchema| TValidateCloudflareConnectionCredentialsSchemadiff --git a/backend/src/services/app-connection/laravel-forge/index.ts b/backend/src/services/app-connection/laravel-forge/index.tsnew file mode 100644index 0000000000..9a3637d065--- /dev/null+++ b/backend/src/services/app-connection/laravel-forge/index.ts@@ -0,0 +1,4 @@+export * from "./laravel-forge-connection-enums";+export * from "./laravel-forge-connection-fns";+export * from "./laravel-forge-connection-schemas";+export * from "./laravel-forge-connection-types";diff --git a/backend/src/services/app-connection/laravel-forge/laravel-forge-connection-enums.ts b/backend/src/services/app-connection/laravel-forge/laravel-forge-connection-enums.tsnew file mode 100644index 0000000000..548d3adfb1--- /dev/null+++ b/backend/src/services/app-connection/laravel-forge/laravel-forge-connection-enums.ts@@ -0,0 +1,3 @@+export enum LaravelForgeConnectionMethod {+ ApiToken = "api-token"+}diff --git a/backend/src/services/app-connection/laravel-forge/laravel-forge-connection-fns.ts b/backend/src/services/app-connection/laravel-forge/laravel-forge-connection-fns.tsnew file mode 100644index 0000000000..ec54b77ae6--- /dev/null+++ b/backend/src/services/app-connection/laravel-forge/laravel-forge-connection-fns.ts@@ -0,0 +1,43 @@+import { AxiosError } from "axios";++import { request } from "@app/lib/config/request";+import { BadRequestError } from "@app/lib/errors";+import { IntegrationUrls } from "@app/services/integration-auth/integration-list";++import { AppConnection } from "../app-connection-enums";+import { LaravelForgeConnectionMethod } from "./laravel-forge-connection-enums";+import { TLaravelForgeConnectionConfig } from "./laravel-forge-connection-types";++export const getLaravelForgeConnectionListItem = () => {+ return {+ name: "Laravel Forge" as const,+ app: AppConnection.LaravelForge as const,+ methods: Object.values(LaravelForgeConnectionMethod) as [LaravelForgeConnectionMethod.ApiToken]+ };+};++export const validateLaravelForgeConnectionCredentials = async (config: TLaravelForgeConnectionConfig) => {+ const { credentials: inputCredentials } = config;++ try {+ // Using the /api/me endpoint to validate the API token+ await request.get(`${IntegrationUrls.LARAVELFORGE_API_URL}/api/me`, {+ headers: {+ Authorization: `Bearer ${inputCredentials.apiToken}`,+ Accept: "application/json",+ "Content-Type": "application/json"+ }+ });+ } catch (error) {+ if (error instanceof AxiosError) {+ throw new BadRequestError({+ message: `Failed to validate credentials: ${error.message || "Unknown error"}`+ });+ }+ throw new BadRequestError({+ message: "Unable to validate connection: verify credentials"+ });+ }++ return inputCredentials;+};diff --git a/backend/src/services/app-connection/laravel-forge/laravel-forge-connection-schemas.ts b/backend/src/services/app-connection/laravel-forge/laravel-forge-connection-schemas.tsnew file mode 100644index 0000000000..1647b38a12--- /dev/null+++ b/backend/src/services/app-connection/laravel-forge/laravel-forge-connection-schemas.ts@@ -0,0 +1,58 @@+import z from "zod";++import { AppConnections } from "@app/lib/api-docs";+import { AppConnection } from "@app/services/app-connection/app-connection-enums";+import {+ BaseAppConnectionSchema,+ GenericCreateAppConnectionFieldsSchema,+ GenericUpdateAppConnectionFieldsSchema+} from "@app/services/app-connection/app-connection-schemas";++import { LaravelForgeConnectionMethod } from "./laravel-forge-connection-enums";++export const LaravelForgeConnectionApiTokenCredentialsSchema = z.object({+ apiToken: z.string().trim().min(1, "API token required").describe(AppConnections.CREDENTIALS.LARAVEL_FORGE.apiToken)+});++const BaseLaravelForgeConnectionSchema = BaseAppConnectionSchema.extend({ app: z.literal(AppConnection.LaravelForge) });++export const LaravelForgeConnectionSchema = BaseLaravelForgeConnectionSchema.extend({+ method: z.literal(LaravelForgeConnectionMethod.ApiToken),+ credentials: LaravelForgeConnectionApiTokenCredentialsSchema+});++export const SanitizedLaravelForgeConnectionSchema = z.discriminatedUnion("method", [+ BaseLaravelForgeConnectionSchema.extend({+ method: z.literal(LaravelForgeConnectionMethod.ApiToken),+ credentials: LaravelForgeConnectionApiTokenCredentialsSchema.pick({})+ })+]);++export const ValidateLaravelForgeConnectionCredentialsSchema = z.discriminatedUnion("method", [+ z.object({+ method: z+ .literal(LaravelForgeConnectionMethod.ApiToken)+ .describe(AppConnections.CREATE(AppConnection.LaravelForge).method),+ credentials: LaravelForgeConnectionApiTokenCredentialsSchema.describe(+ AppConnections.CREATE(AppConnection.LaravelForge).credentials+ )+ })+]);++export const CreateLaravelForgeConnectionSchema = ValidateLaravelForgeConnectionCredentialsSchema.and(+ GenericCreateAppConnectionFieldsSchema(AppConnection.LaravelForge)+);++export const UpdateLaravelForgeConnectionSchema = z+ .object({+ credentials: LaravelForgeConnectionApiTokenCredentialsSchema.optional().describe(+ AppConnections.UPDATE(AppConnection.LaravelForge).credentials+ )+ })+ .and(GenericUpdateAppConnectionFieldsSchema(AppConnection.LaravelForge));++export const LaravelForgeConnectionListItemSchema = z.object({+ name: z.literal("Laravel Forge"),+ app: z.literal(AppConnection.LaravelForge),+ methods: z.nativeEnum(LaravelForgeConnectionMethod).array()+});diff --git a/backend/src/services/app-connection/laravel-forge/laravel-forge-connection-service.ts b/backend/src/services/app-connection/laravel-forge/laravel-forge-connection-service.tsnew file mode 100644index 0000000000..92a7e97e1f--- /dev/null+++ b/backend/src/services/app-connection/laravel-forge/laravel-forge-connection-service.ts@@ -0,0 +1,14 @@+import { OrgServiceActor } from "@app/lib/types";++import { AppConnection } from "../app-connection-enums";+import { TLaravelForgeConnection } from "./laravel-forge-connection-types";++type TGetAppConnectionFunc = (+ app: AppConnection,+ connectionId: string,+ actor: OrgServiceActor+) => Promise<TLaravelForgeConnection>;++export const laravelForgeConnectionService = (getAppConnection: TGetAppConnectionFunc) => {+ console.log("laravelForgeConnectionService", getAppConnection);+};diff --git a/backend/src/services/app-connection/laravel-forge/laravel-forge-connection-types.ts b/backend/src/services/app-connection/laravel-forge/laravel-forge-connection-types.tsnew file mode 100644index 0000000000..9ae3ce6e1d--- /dev/null+++ b/backend/src/services/app-connection/laravel-forge/laravel-forge-connection-types.ts@@ -0,0 +1,25 @@+import z from "zod";++import { DiscriminativePick } from "@app/lib/types";++import { AppConnection } from "../app-connection-enums";+import {+ CreateLaravelForgeConnectionSchema,+ LaravelForgeConnectionSchema,+ ValidateLaravelForgeConnectionCredentialsSchema+} from "./laravel-forge-connection-schemas";++export type TLaravelForgeConnection = z.infer<typeof LaravelForgeConnectionSchema>;++export type TLaravelForgeConnectionInput = z.infer<typeof CreateLaravelForgeConnectionSchema> & {+ app: AppConnection.LaravelForge;+};++export type TValidateLaravelForgeConnectionCredentialsSchema = typeof ValidateLaravelForgeConnectionCredentialsSchema;++export type TLaravelForgeConnectionConfig = DiscriminativePick<+ TLaravelForgeConnectionInput,+ "method" | "app" | "credentials"+> & {+ orgId: string;+};diff --git a/backend/src/services/secret-sync/secret-sync-enums.ts b/backend/src/services/secret-sync/secret-sync-enums.tsindex fe0dc9f56c..235b3db3a3 100644--- a/backend/src/services/secret-sync/secret-sync-enums.ts+++ b/backend/src/services/secret-sync/secret-sync-enums.ts@@ -28,7 +28,8 @@ export enum SecretSync {Checkly = "checkly",DigitalOceanAppPlatform = "digital-ocean-app-platform",Netlify = "netlify",- Bitbucket = "bitbucket"+ Bitbucket = "bitbucket",+ LaravelForge = "laravel-forge"}export enum SecretSyncInitialSyncBehavior {diff --git a/backend/src/services/secret-sync/secret-sync-maps.ts b/backend/src/services/secret-sync/secret-sync-maps.tsindex 1fbc66ccab..0ec8aede07 100644--- a/backend/src/services/secret-sync/secret-sync-maps.ts+++ b/backend/src/services/secret-sync/secret-sync-maps.ts@@ -32,7 +32,8 @@ export const SECRET_SYNC_NAME_MAP: Record<SecretSync, string> = {[SecretSync.Checkly]: "Checkly",[SecretSync.DigitalOceanAppPlatform]: "Digital Ocean App Platform",[SecretSync.Netlify]: "Netlify",- [SecretSync.Bitbucket]: "Bitbucket"+ [SecretSync.Bitbucket]: "Bitbucket",+ [SecretSync.LaravelForge]: "Laravel Forge"};export const SECRET_SYNC_CONNECTION_MAP: Record<SecretSync, AppConnection> = {@@ -65,7 +66,8 @@ export const SECRET_SYNC_CONNECTION_MAP: Record<SecretSync, AppConnection> = {[SecretSync.Checkly]: AppConnection.Checkly,[SecretSync.DigitalOceanAppPlatform]: AppConnection.DigitalOcean,[SecretSync.Netlify]: AppConnection.Netlify,- [SecretSync.Bitbucket]: AppConnection.Bitbucket+ [SecretSync.Bitbucket]: AppConnection.Bitbucket,+ [SecretSync.LaravelForge]: AppConnection.LaravelForge};export const SECRET_SYNC_PLAN_MAP: Record<SecretSync, SecretSyncPlanType> = {@@ -98,7 +100,8 @@ export const SECRET_SYNC_PLAN_MAP: Record<SecretSync, SecretSyncPlanType> = {[SecretSync.Checkly]: SecretSyncPlanType.Regular,[SecretSync.DigitalOceanAppPlatform]: SecretSyncPlanType.Regular,[SecretSync.Netlify]: SecretSyncPlanType.Regular,- [SecretSync.Bitbucket]: SecretSyncPlanType.Regular+ [SecretSync.Bitbucket]: SecretSyncPlanType.Regular,+ [SecretSync.LaravelForge]: SecretSyncPlanType.Regular};export const SECRET_SYNC_SKIP_FIELDS_MAP: Record<SecretSync, string[]> = {@@ -140,7 +143,8 @@ export const SECRET_SYNC_SKIP_FIELDS_MAP: Record<SecretSync, string[]> = {[SecretSync.Checkly]: ["groupName", "accountName"],[SecretSync.DigitalOceanAppPlatform]: ["appName"],[SecretSync.Netlify]: ["accountName", "siteName"],- [SecretSync.Bitbucket]: []+ [SecretSync.Bitbucket]: [],+ [SecretSync.LaravelForge]: []};const defaultDuplicateCheck: DestinationDuplicateCheckFn = () => true;@@ -199,5 +203,6 @@ export const DESTINATION_DUPLICATE_CHECK_MAP: Record<SecretSync, DestinationDupl[SecretSync.Checkly]: defaultDuplicateCheck,[SecretSync.DigitalOceanAppPlatform]: defaultDuplicateCheck,[SecretSync.Netlify]: defaultDuplicateCheck,- [SecretSync.Bitbucket]: defaultDuplicateCheck+ [SecretSync.Bitbucket]: defaultDuplicateCheck,+ [SecretSync.LaravelForge]: defaultDuplicateCheck};diff --git a/frontend/src/helpers/appConnections.ts b/frontend/src/helpers/appConnections.tsindex d0e3dcba17..f53a8901d6 100644--- a/frontend/src/helpers/appConnections.ts+++ b/frontend/src/helpers/appConnections.ts@@ -48,6 +48,7 @@ import { BitbucketConnectionMethod } from "@app/hooks/api/appConnections/types/bimport { ChecklyConnectionMethod } from "@app/hooks/api/appConnections/types/checkly-connection";import { DigitalOceanConnectionMethod } from "@app/hooks/api/appConnections/types/digital-ocean";import { HerokuConnectionMethod } from "@app/hooks/api/appConnections/types/heroku-connection";+import { LaravelForgeConnectionMethod } from "@app/hooks/api/appConnections/types/laravel-forge-connection";import { NetlifyConnectionMethod } from "@app/hooks/api/appConnections/types/netlify-connection";import { OCIConnectionMethod } from "@app/hooks/api/appConnections/types/oci-connection";import { RailwayConnectionMethod } from "@app/hooks/api/appConnections/types/railway-connection";@@ -115,7 +116,8 @@ export const APP_CONNECTION_MAP: Record<image: "Netlify.png"},[AppConnection.Okta]: { name: "Okta", image: "Okta.png" },- [AppConnection.Redis]: { name: "Redis", image: "Redis.png" }+ [AppConnection.Redis]: { name: "Redis", image: "Redis.png" },+ [AppConnection.LaravelForge]: { name: "Laravel Forge", image: "Laravel Forge.png" }};export const getAppConnectionMethodDetails = (method: TAppConnection["method"]) => {@@ -151,6 +153,7 @@ export const getAppConnectionMethodDetails = (method: TAppConnection["method"])case ZabbixConnectionMethod.ApiToken:case DigitalOceanConnectionMethod.ApiToken:case OktaConnectionMethod.ApiToken:+ case LaravelForgeConnectionMethod.ApiToken:return { name: "API Token", icon: faKey };case PostgresConnectionMethod.UsernameAndPassword:case MsSqlConnectionMethod.UsernameAndPassword:diff --git a/frontend/src/hooks/api/appConnections/enums.ts b/frontend/src/hooks/api/appConnections/enums.tsindex e897cf0f08..66fed8a5df 100644--- a/frontend/src/hooks/api/appConnections/enums.ts+++ b/frontend/src/hooks/api/appConnections/enums.ts@@ -37,5 +37,6 @@ export enum AppConnection {DigitalOcean = "digital-ocean",Netlify = "netlify",Okta = "okta",- Redis = "redis"+ Redis = "redis",+ LaravelForge = "laravel-forge"}diff --git a/frontend/src/hooks/api/appConnections/types/app-options.ts b/frontend/src/hooks/api/appConnections/types/app-options.tsindex fdaae2c741..797e7a7c69 100644--- a/frontend/src/hooks/api/appConnections/types/app-options.ts+++ b/frontend/src/hooks/api/appConnections/types/app-options.ts@@ -164,6 +164,10 @@ export type TOktaConnectionOption = TAppConnectionOptionBase & {app: AppConnection.Okta;};+export type TLaravelForgeConnectionOption = TAppConnectionOptionBase & {+ app: AppConnection.LaravelForge;+};+export type TAzureAdCsConnectionOption = TAppConnectionOptionBase & {app: AppConnection.AzureADCS;};@@ -210,7 +214,8 @@ export type TAppConnectionOption =| TDigitalOceanConnectionOption| TNetlifyConnectionOption| TOktaConnectionOption- | TAzureAdCsConnectionOption;+ | TAzureAdCsConnectionOption+ | TLaravelForgeConnectionOption;export type TAppConnectionOptionMap = {[AppConnection.AWS]: TAwsConnectionOption;@@ -252,4 +257,5 @@ export type TAppConnectionOptionMap = {[AppConnection.Okta]: TOktaConnectionOption;[AppConnection.AzureADCS]: TAzureAdCsConnectionOption;[AppConnection.Redis]: TRedisConnectionOption;+ [AppConnection.LaravelForge]: TLaravelForgeConnectionOption;};diff --git a/frontend/src/hooks/api/appConnections/types/index.ts b/frontend/src/hooks/api/appConnections/types/index.tsindex 9f8df7cfab..fd840d5de1 100644--- a/frontend/src/hooks/api/appConnections/types/index.ts+++ b/frontend/src/hooks/api/appConnections/types/index.ts@@ -22,6 +22,7 @@ import { TGitLabConnection } from "./gitlab-connection";import { THCVaultConnection } from "./hc-vault-connection";import { THerokuConnection } from "./heroku-connection";import { THumanitecConnection } from "./humanitec-connection";+import { TLaravelForgeConnection } from "./laravel-forge-connection";import { TLdapConnection } from "./ldap-connection";import { TMsSqlConnection } from "./mssql-connection";import { TMySqlConnection } from "./mysql-connection";@@ -61,6 +62,7 @@ export * from "./gitlab-connection";export * from "./hc-vault-connection";export * from "./heroku-connection";export * from "./humanitec-connection";+export * from "./laravel-forge-connection";export * from "./ldap-connection";export * from "./mssql-connection";export * from "./mysql-connection";@@ -105,6 +107,7 @@ export type TAppConnection =| TOCIConnection| TOnePassConnection| THerokuConnection+ | TLaravelForgeConnection| TRenderConnection| TFlyioConnection| TGitLabConnectiondiff --git a/frontend/src/hooks/api/appConnections/types/laravel-forge-connection.ts b/frontend/src/hooks/api/appConnections/types/laravel-forge-connection.tsnew file mode 100644index 0000000000..ac48d929d3--- /dev/null+++ b/frontend/src/hooks/api/appConnections/types/laravel-forge-connection.ts@@ -0,0 +1,13 @@+import { AppConnection } from "@app/hooks/api/appConnections/enums";+import { TRootAppConnection } from "@app/hooks/api/appConnections/types/root-connection";++export enum LaravelForgeConnectionMethod {+ ApiToken = "api-token"+}++export type TLaravelForgeConnection = TRootAppConnection & { app: AppConnection.LaravelForge } & {+ method: LaravelForgeConnectionMethod.ApiToken;+ credentials: {+ apiToken: string;+ };+};diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsxindex 42b00f44a3..a44c4746bc 100644--- a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx@@ -31,6 +31,7 @@ import { GitLabConnectionForm } from "./GitLabConnectionForm";import { HCVaultConnectionForm } from "./HCVaultConnectionForm";import { HerokuConnectionForm } from "./HerokuAppConnectionForm";import { HumanitecConnectionForm } from "./HumanitecConnectionForm";+import { LaravelForgeConnectionForm } from "./LaravelForgeConnectionForm";import { LdapConnectionForm } from "./LdapConnectionForm";import { MsSqlConnectionForm } from "./MsSqlConnectionForm";import { MySqlConnectionForm } from "./MySqlConnectionForm";@@ -146,6 +147,8 @@ const CreateForm = ({ app, onComplete, projectId }: CreateFormProps) => {return <HerokuConnectionForm onSubmit={onSubmit} projectId={projectId} />;case AppConnection.Render:return <RenderConnectionForm onSubmit={onSubmit} />;+ case AppConnection.LaravelForge:+ return <LaravelForgeConnectionForm onSubmit={onSubmit} />;case AppConnection.Flyio:return <FlyioConnectionForm onSubmit={onSubmit} />;case AppConnection.GitLab:@@ -297,6 +300,8 @@ const UpdateForm = ({ appConnection, onComplete }: UpdateFormProps) => {);case AppConnection.Render:return <RenderConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;+ case AppConnection.LaravelForge:+ return <LaravelForgeConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;case AppConnection.Flyio:return <FlyioConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;case AppConnection.GitLab:diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/LaravelForgeConnectionForm.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/LaravelForgeConnectionForm.tsxnew file mode 100644index 0000000000..f115942ebd--- /dev/null+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/LaravelForgeConnectionForm.tsx@@ -0,0 +1,136 @@+import { Controller, FormProvider, useForm } from "react-hook-form";+import { zodResolver } from "@hookform/resolvers/zod";+import { z } from "zod";++import {+ Button,+ FormControl,+ ModalClose,+ SecretInput,+ Select,+ SelectItem+} from "@app/components/v2";+import { APP_CONNECTION_MAP, getAppConnectionMethodDetails } from "@app/helpers/appConnections";+import {+ LaravelForgeConnectionMethod,+ TLaravelForgeConnection+} from "@app/hooks/api/appConnections";+import { AppConnection } from "@app/hooks/api/appConnections/enums";++import {+ genericAppConnectionFieldsSchema,+ GenericAppConnectionsFields+} from "./GenericAppConnectionFields";++type Props = {+ appConnection?: TLaravelForgeConnection;+ onSubmit: (formData: FormData) => Promise<void>;+};++const rootSchema = genericAppConnectionFieldsSchema.extend({+ app: z.literal(AppConnection.LaravelForge)+});++const formSchema = z.discriminatedUnion("method", [+ rootSchema.extend({+ method: z.literal(LaravelForgeConnectionMethod.ApiToken),+ credentials: z.object({+ apiToken: z.string().trim().min(1, "API Token required")+ })+ })+]);++type FormData = z.infer<typeof formSchema>;++export const LaravelForgeConnectionForm = ({ appConnection, onSubmit }: Props) => {+ const isUpdate = Boolean(appConnection);++ const form = useForm<FormData>({+ resolver: zodResolver(formSchema),+ defaultValues: appConnection ?? {+ app: AppConnection.LaravelForge,+ method: LaravelForgeConnectionMethod.ApiToken+ }+ });++ const {+ handleSubmit,+ control,+ formState: { isSubmitting, isDirty }+ } = form;++ return (+ <FormProvider {...form}>+ <form onSubmit={handleSubmit(onSubmit)}>+ {!isUpdate && <GenericAppConnectionsFields />}++ <Controller+ name="method"+ control={control}+ render={({ field: { value, onChange }, fieldState: { error } }) => (+ <FormControl+ tooltipText={`The method you would like to use to connect with ${+ APP_CONNECTION_MAP[AppConnection.LaravelForge].name+ }. This field cannot be changed after creation.`}+ errorText={error?.message}+ isError={Boolean(error?.message)}+ label="Method"+ >+ <Select+ isDisabled={isUpdate}+ value={value}+ onValueChange={(val) => onChange(val)}+ className="w-full border border-mineshaft-500"+ position="popper"+ dropdownContainerClassName="max-w-none"+ >+ {Object.values(LaravelForgeConnectionMethod).map((method) => {+ return (+ <SelectItem value={method} key={method}>+ {getAppConnectionMethodDetails(method).name}{" "}+ </SelectItem>+ );+ })}+ </Select>+ </FormControl>+ )}+ />+ <Controller+ name="credentials.apiToken"+ control={control}+ shouldUnregister+ render={({ field: { value, onChange }, fieldState: { error } }) => (+ <FormControl+ errorText={error?.message}+ isError={Boolean(error?.message)}+ label="API Token"+ >+ <SecretInput+ containerClassName="text-gray-400 group-focus-within:!border-primary-400/50 border border-mineshaft-500 bg-mineshaft-900 px-2.5 py-1.5"+ value={value}+ onChange={(e) => onChange(e.target.value)}+ />+ </FormControl>+ )}+ />+ <div className="mt-8 flex items-center">+ <Button+ className="mr-4"+ size="sm"+ type="submit"+ colorSchema="secondary"+ isLoading={isSubmitting}+ isDisabled={isSubmitting || !isDirty}+ >+ {isUpdate ? "Update Credentials" : "Connect to Laravel Forge"}+ </Button>+ <ModalClose asChild>+ <Button colorSchema="secondary" variant="plain">+ Cancel+ </Button>+ </ModalClose>+ </div>+ </form>+ </FormProvider>+ );+};