Merge pull request #4665 from Infisical/feat/laravel-forge-app-conn-and-secret-sync
feat: Adds laravel forge app connection and secret sync
@@ -2355,6 +2355,9 @@ export const AppConnections = {
|
|||||||
sslRejectUnauthorized:
|
sslRejectUnauthorized:
|
||||||
"Whether or not to reject unauthorized SSL certificates (true/false). Set to false only in test environments with self-signed certificates.",
|
"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."
|
sslCertificate: "The SSL certificate (PEM format) to use for secure connection."
|
||||||
|
},
|
||||||
|
LARAVEL_FORGE: {
|
||||||
|
apiToken: "The API token used to authenticate with Laravel Forge."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -2507,6 +2510,14 @@ export const SecretSyncs = {
|
|||||||
branch: "The branch to sync preview secrets to.",
|
branch: "The branch to sync preview secrets to.",
|
||||||
teamId: "The ID of the Vercel team to sync secrets to."
|
teamId: "The ID of the Vercel team to sync secrets to."
|
||||||
},
|
},
|
||||||
|
LARAVEL_FORGE: {
|
||||||
|
orgSlug: "The slug of the Laravel Forge org to sync secrets to.",
|
||||||
|
orgName: "The name of the Laravel Forge org to sync secrets to.",
|
||||||
|
serverId: "The ID of the Laravel Forge server to sync secrets to.",
|
||||||
|
serverName: "The name of the Laravel Forge server to sync secrets to.",
|
||||||
|
siteId: "The ID of the Laravel Forge site to sync secrets to.",
|
||||||
|
siteName: "The name of the Laravel Forge site to sync secrets to."
|
||||||
|
},
|
||||||
WINDMILL: {
|
WINDMILL: {
|
||||||
workspace: "The Windmill workspace to sync secrets to.",
|
workspace: "The Windmill workspace to sync secrets to.",
|
||||||
path: "The Windmill workspace path to sync secrets to."
|
path: "The Windmill workspace path to sync secrets to."
|
||||||
|
|||||||
@@ -77,6 +77,10 @@ import {
|
|||||||
HumanitecConnectionListItemSchema,
|
HumanitecConnectionListItemSchema,
|
||||||
SanitizedHumanitecConnectionSchema
|
SanitizedHumanitecConnectionSchema
|
||||||
} from "@app/services/app-connection/humanitec";
|
} 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 { LdapConnectionListItemSchema, SanitizedLdapConnectionSchema } from "@app/services/app-connection/ldap";
|
||||||
import { MsSqlConnectionListItemSchema, SanitizedMsSqlConnectionSchema } from "@app/services/app-connection/mssql";
|
import { MsSqlConnectionListItemSchema, SanitizedMsSqlConnectionSchema } from "@app/services/app-connection/mssql";
|
||||||
import { MySqlConnectionListItemSchema, SanitizedMySqlConnectionSchema } from "@app/services/app-connection/mysql";
|
import { MySqlConnectionListItemSchema, SanitizedMySqlConnectionSchema } from "@app/services/app-connection/mysql";
|
||||||
@@ -158,7 +162,8 @@ const SanitizedAppConnectionSchema = z.union([
|
|||||||
...SanitizedNetlifyConnectionSchema.options,
|
...SanitizedNetlifyConnectionSchema.options,
|
||||||
...SanitizedOktaConnectionSchema.options,
|
...SanitizedOktaConnectionSchema.options,
|
||||||
...SanitizedAzureADCSConnectionSchema.options,
|
...SanitizedAzureADCSConnectionSchema.options,
|
||||||
...SanitizedRedisConnectionSchema.options
|
...SanitizedRedisConnectionSchema.options,
|
||||||
|
...SanitizedLaravelForgeConnectionSchema.options
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const AppConnectionOptionsSchema = z.discriminatedUnion("app", [
|
const AppConnectionOptionsSchema = z.discriminatedUnion("app", [
|
||||||
@@ -200,7 +205,8 @@ const AppConnectionOptionsSchema = z.discriminatedUnion("app", [
|
|||||||
NetlifyConnectionListItemSchema,
|
NetlifyConnectionListItemSchema,
|
||||||
OktaConnectionListItemSchema,
|
OktaConnectionListItemSchema,
|
||||||
AzureADCSConnectionListItemSchema,
|
AzureADCSConnectionListItemSchema,
|
||||||
RedisConnectionListItemSchema
|
RedisConnectionListItemSchema,
|
||||||
|
LaravelForgeConnectionListItemSchema
|
||||||
]);
|
]);
|
||||||
|
|
||||||
export const registerAppConnectionRouter = async (server: FastifyZodProvider) => {
|
export const registerAppConnectionRouter = async (server: FastifyZodProvider) => {
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import { registerGitLabConnectionRouter } from "./gitlab-connection-router";
|
|||||||
import { registerHCVaultConnectionRouter } from "./hc-vault-connection-router";
|
import { registerHCVaultConnectionRouter } from "./hc-vault-connection-router";
|
||||||
import { registerHerokuConnectionRouter } from "./heroku-connection-router";
|
import { registerHerokuConnectionRouter } from "./heroku-connection-router";
|
||||||
import { registerHumanitecConnectionRouter } from "./humanitec-connection-router";
|
import { registerHumanitecConnectionRouter } from "./humanitec-connection-router";
|
||||||
|
import { registerLaravelForgeConnectionRouter } from "./laravel-forge-connection-router";
|
||||||
import { registerLdapConnectionRouter } from "./ldap-connection-router";
|
import { registerLdapConnectionRouter } from "./ldap-connection-router";
|
||||||
import { registerMsSqlConnectionRouter } from "./mssql-connection-router";
|
import { registerMsSqlConnectionRouter } from "./mssql-connection-router";
|
||||||
import { registerMySqlConnectionRouter } from "./mysql-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.OnePass]: registerOnePassConnectionRouter,
|
||||||
[AppConnection.Heroku]: registerHerokuConnectionRouter,
|
[AppConnection.Heroku]: registerHerokuConnectionRouter,
|
||||||
[AppConnection.Render]: registerRenderConnectionRouter,
|
[AppConnection.Render]: registerRenderConnectionRouter,
|
||||||
|
[AppConnection.LaravelForge]: registerLaravelForgeConnectionRouter,
|
||||||
[AppConnection.Flyio]: registerFlyioConnectionRouter,
|
[AppConnection.Flyio]: registerFlyioConnectionRouter,
|
||||||
[AppConnection.GitLab]: registerGitLabConnectionRouter,
|
[AppConnection.GitLab]: registerGitLabConnectionRouter,
|
||||||
[AppConnection.Cloudflare]: registerCloudflareConnectionRouter,
|
[AppConnection.Cloudflare]: registerCloudflareConnectionRouter,
|
||||||
|
|||||||
@@ -0,0 +1,128 @@
|
|||||||
|
import z from "zod";
|
||||||
|
|
||||||
|
import { readLimit } from "@app/server/config/rateLimiter";
|
||||||
|
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
||||||
|
import { AppConnection } from "@app/services/app-connection/app-connection-enums";
|
||||||
|
import {
|
||||||
|
CreateLaravelForgeConnectionSchema,
|
||||||
|
SanitizedLaravelForgeConnectionSchema,
|
||||||
|
UpdateLaravelForgeConnectionSchema
|
||||||
|
} from "@app/services/app-connection/laravel-forge";
|
||||||
|
import { AuthMode } from "@app/services/auth/auth-type";
|
||||||
|
|
||||||
|
import { registerAppConnectionEndpoints } from "./app-connection-endpoints";
|
||||||
|
|
||||||
|
export const registerLaravelForgeConnectionRouter = async (server: FastifyZodProvider) => {
|
||||||
|
registerAppConnectionEndpoints({
|
||||||
|
app: AppConnection.LaravelForge,
|
||||||
|
server,
|
||||||
|
sanitizedResponseSchema: SanitizedLaravelForgeConnectionSchema,
|
||||||
|
createSchema: CreateLaravelForgeConnectionSchema,
|
||||||
|
updateSchema: UpdateLaravelForgeConnectionSchema
|
||||||
|
});
|
||||||
|
server.route({
|
||||||
|
method: "GET",
|
||||||
|
url: `/:connectionId/organizations`,
|
||||||
|
config: {
|
||||||
|
rateLimit: readLimit
|
||||||
|
},
|
||||||
|
schema: {
|
||||||
|
params: z.object({
|
||||||
|
connectionId: z.string().uuid()
|
||||||
|
}),
|
||||||
|
response: {
|
||||||
|
200: z
|
||||||
|
.object({
|
||||||
|
id: z.string(),
|
||||||
|
name: z.string(),
|
||||||
|
slug: z.string()
|
||||||
|
})
|
||||||
|
.array()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onRequest: verifyAuth([AuthMode.JWT]),
|
||||||
|
handler: async (req) => {
|
||||||
|
const { connectionId } = req.params;
|
||||||
|
const organizations = await server.services.appConnection.laravelForge.listOrganizations(
|
||||||
|
connectionId,
|
||||||
|
req.permission
|
||||||
|
);
|
||||||
|
|
||||||
|
return organizations;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
server.route({
|
||||||
|
method: "GET",
|
||||||
|
url: `/:connectionId/servers`,
|
||||||
|
config: {
|
||||||
|
rateLimit: readLimit
|
||||||
|
},
|
||||||
|
schema: {
|
||||||
|
params: z.object({
|
||||||
|
connectionId: z.string().uuid()
|
||||||
|
}),
|
||||||
|
querystring: z.object({
|
||||||
|
organizationSlug: z.string()
|
||||||
|
}),
|
||||||
|
response: {
|
||||||
|
200: z
|
||||||
|
.object({
|
||||||
|
id: z.string(),
|
||||||
|
name: z.string()
|
||||||
|
})
|
||||||
|
.array()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onRequest: verifyAuth([AuthMode.JWT]),
|
||||||
|
handler: async (req) => {
|
||||||
|
const { connectionId } = req.params;
|
||||||
|
const { organizationSlug } = req.query;
|
||||||
|
const servers = await server.services.appConnection.laravelForge.listServers(
|
||||||
|
connectionId,
|
||||||
|
req.permission,
|
||||||
|
organizationSlug
|
||||||
|
);
|
||||||
|
|
||||||
|
return servers;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
server.route({
|
||||||
|
method: "GET",
|
||||||
|
url: `/:connectionId/sites`,
|
||||||
|
config: {
|
||||||
|
rateLimit: readLimit
|
||||||
|
},
|
||||||
|
schema: {
|
||||||
|
params: z.object({
|
||||||
|
connectionId: z.string().uuid()
|
||||||
|
}),
|
||||||
|
querystring: z.object({
|
||||||
|
organizationSlug: z.string(),
|
||||||
|
serverId: z.string()
|
||||||
|
}),
|
||||||
|
response: {
|
||||||
|
200: z
|
||||||
|
.object({
|
||||||
|
id: z.string(),
|
||||||
|
name: z.string()
|
||||||
|
})
|
||||||
|
.array()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onRequest: verifyAuth([AuthMode.JWT]),
|
||||||
|
handler: async (req) => {
|
||||||
|
const { connectionId } = req.params;
|
||||||
|
const { organizationSlug, serverId } = req.query;
|
||||||
|
const sites = await server.services.appConnection.laravelForge.listSites(
|
||||||
|
connectionId,
|
||||||
|
req.permission,
|
||||||
|
organizationSlug,
|
||||||
|
serverId
|
||||||
|
);
|
||||||
|
|
||||||
|
return sites;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
@@ -21,6 +21,7 @@ import { registerGitLabSyncRouter } from "./gitlab-sync-router";
|
|||||||
import { registerHCVaultSyncRouter } from "./hc-vault-sync-router";
|
import { registerHCVaultSyncRouter } from "./hc-vault-sync-router";
|
||||||
import { registerHerokuSyncRouter } from "./heroku-sync-router";
|
import { registerHerokuSyncRouter } from "./heroku-sync-router";
|
||||||
import { registerHumanitecSyncRouter } from "./humanitec-sync-router";
|
import { registerHumanitecSyncRouter } from "./humanitec-sync-router";
|
||||||
|
import { registerLaravelForgeSyncRouter } from "./laravel-forge-sync-router";
|
||||||
import { registerNetlifySyncRouter } from "./netlify-sync-router";
|
import { registerNetlifySyncRouter } from "./netlify-sync-router";
|
||||||
import { registerRailwaySyncRouter } from "./railway-sync-router";
|
import { registerRailwaySyncRouter } from "./railway-sync-router";
|
||||||
import { registerRenderSyncRouter } from "./render-sync-router";
|
import { registerRenderSyncRouter } from "./render-sync-router";
|
||||||
@@ -63,5 +64,6 @@ export const SECRET_SYNC_REGISTER_ROUTER_MAP: Record<SecretSync, (server: Fastif
|
|||||||
[SecretSync.Checkly]: registerChecklySyncRouter,
|
[SecretSync.Checkly]: registerChecklySyncRouter,
|
||||||
[SecretSync.DigitalOceanAppPlatform]: registerDigitalOceanAppPlatformSyncRouter,
|
[SecretSync.DigitalOceanAppPlatform]: registerDigitalOceanAppPlatformSyncRouter,
|
||||||
[SecretSync.Netlify]: registerNetlifySyncRouter,
|
[SecretSync.Netlify]: registerNetlifySyncRouter,
|
||||||
[SecretSync.Bitbucket]: registerBitbucketSyncRouter
|
[SecretSync.Bitbucket]: registerBitbucketSyncRouter,
|
||||||
|
[SecretSync.LaravelForge]: registerLaravelForgeSyncRouter
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import {
|
||||||
|
CreateLaravelForgeSyncSchema,
|
||||||
|
LaravelForgeSyncSchema,
|
||||||
|
UpdateLaravelForgeSyncSchema
|
||||||
|
} from "@app/services/secret-sync/laravel-forge";
|
||||||
|
import { SecretSync } from "@app/services/secret-sync/secret-sync-enums";
|
||||||
|
|
||||||
|
import { registerSyncSecretsEndpoints } from "./secret-sync-endpoints";
|
||||||
|
|
||||||
|
export const registerLaravelForgeSyncRouter = async (server: FastifyZodProvider) =>
|
||||||
|
registerSyncSecretsEndpoints({
|
||||||
|
destination: SecretSync.LaravelForge,
|
||||||
|
server,
|
||||||
|
responseSchema: LaravelForgeSyncSchema,
|
||||||
|
createSchema: CreateLaravelForgeSyncSchema,
|
||||||
|
updateSchema: UpdateLaravelForgeSyncSchema
|
||||||
|
});
|
||||||
@@ -44,6 +44,7 @@ import { GitLabSyncListItemSchema, GitLabSyncSchema } from "@app/services/secret
|
|||||||
import { HCVaultSyncListItemSchema, HCVaultSyncSchema } from "@app/services/secret-sync/hc-vault";
|
import { HCVaultSyncListItemSchema, HCVaultSyncSchema } from "@app/services/secret-sync/hc-vault";
|
||||||
import { HerokuSyncListItemSchema, HerokuSyncSchema } from "@app/services/secret-sync/heroku";
|
import { HerokuSyncListItemSchema, HerokuSyncSchema } from "@app/services/secret-sync/heroku";
|
||||||
import { HumanitecSyncListItemSchema, HumanitecSyncSchema } from "@app/services/secret-sync/humanitec";
|
import { HumanitecSyncListItemSchema, HumanitecSyncSchema } from "@app/services/secret-sync/humanitec";
|
||||||
|
import { LaravelForgeSyncListItemSchema, LaravelForgeSyncSchema } from "@app/services/secret-sync/laravel-forge";
|
||||||
import { NetlifySyncListItemSchema, NetlifySyncSchema } from "@app/services/secret-sync/netlify";
|
import { NetlifySyncListItemSchema, NetlifySyncSchema } from "@app/services/secret-sync/netlify";
|
||||||
import { RailwaySyncListItemSchema, RailwaySyncSchema } from "@app/services/secret-sync/railway/railway-sync-schemas";
|
import { RailwaySyncListItemSchema, RailwaySyncSchema } from "@app/services/secret-sync/railway/railway-sync-schemas";
|
||||||
import { RenderSyncListItemSchema, RenderSyncSchema } from "@app/services/secret-sync/render/render-sync-schemas";
|
import { RenderSyncListItemSchema, RenderSyncSchema } from "@app/services/secret-sync/render/render-sync-schemas";
|
||||||
@@ -84,7 +85,8 @@ const SecretSyncSchema = z.discriminatedUnion("destination", [
|
|||||||
ChecklySyncSchema,
|
ChecklySyncSchema,
|
||||||
DigitalOceanAppPlatformSyncSchema,
|
DigitalOceanAppPlatformSyncSchema,
|
||||||
NetlifySyncSchema,
|
NetlifySyncSchema,
|
||||||
BitbucketSyncSchema
|
BitbucketSyncSchema,
|
||||||
|
LaravelForgeSyncSchema
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const SecretSyncOptionsSchema = z.discriminatedUnion("destination", [
|
const SecretSyncOptionsSchema = z.discriminatedUnion("destination", [
|
||||||
@@ -117,7 +119,8 @@ const SecretSyncOptionsSchema = z.discriminatedUnion("destination", [
|
|||||||
ChecklySyncListItemSchema,
|
ChecklySyncListItemSchema,
|
||||||
SupabaseSyncListItemSchema,
|
SupabaseSyncListItemSchema,
|
||||||
NetlifySyncListItemSchema,
|
NetlifySyncListItemSchema,
|
||||||
BitbucketSyncListItemSchema
|
BitbucketSyncListItemSchema,
|
||||||
|
LaravelForgeSyncListItemSchema
|
||||||
]);
|
]);
|
||||||
|
|
||||||
export const registerSecretSyncRouter = async (server: FastifyZodProvider) => {
|
export const registerSecretSyncRouter = async (server: FastifyZodProvider) => {
|
||||||
|
|||||||
@@ -37,7 +37,8 @@ export enum AppConnection {
|
|||||||
DigitalOcean = "digital-ocean",
|
DigitalOcean = "digital-ocean",
|
||||||
Netlify = "netlify",
|
Netlify = "netlify",
|
||||||
Okta = "okta",
|
Okta = "okta",
|
||||||
Redis = "redis"
|
Redis = "redis",
|
||||||
|
LaravelForge = "laravel-forge"
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum AWSRegion {
|
export enum AWSRegion {
|
||||||
|
|||||||
@@ -103,6 +103,11 @@ import {
|
|||||||
HumanitecConnectionMethod,
|
HumanitecConnectionMethod,
|
||||||
validateHumanitecConnectionCredentials
|
validateHumanitecConnectionCredentials
|
||||||
} from "./humanitec";
|
} from "./humanitec";
|
||||||
|
import {
|
||||||
|
getLaravelForgeConnectionListItem,
|
||||||
|
LaravelForgeConnectionMethod,
|
||||||
|
validateLaravelForgeConnectionCredentials
|
||||||
|
} from "./laravel-forge";
|
||||||
import { getLdapConnectionListItem, LdapConnectionMethod, validateLdapConnectionCredentials } from "./ldap";
|
import { getLdapConnectionListItem, LdapConnectionMethod, validateLdapConnectionCredentials } from "./ldap";
|
||||||
import { getMsSqlConnectionListItem, MsSqlConnectionMethod } from "./mssql";
|
import { getMsSqlConnectionListItem, MsSqlConnectionMethod } from "./mssql";
|
||||||
import { MySqlConnectionMethod } from "./mysql/mysql-connection-enums";
|
import { MySqlConnectionMethod } from "./mysql/mysql-connection-enums";
|
||||||
@@ -187,6 +192,7 @@ export const listAppConnectionOptions = (projectType?: ProjectType) => {
|
|||||||
getOnePassConnectionListItem(),
|
getOnePassConnectionListItem(),
|
||||||
getHerokuConnectionListItem(),
|
getHerokuConnectionListItem(),
|
||||||
getRenderConnectionListItem(),
|
getRenderConnectionListItem(),
|
||||||
|
getLaravelForgeConnectionListItem(),
|
||||||
getFlyioConnectionListItem(),
|
getFlyioConnectionListItem(),
|
||||||
getGitLabConnectionListItem(),
|
getGitLabConnectionListItem(),
|
||||||
getCloudflareConnectionListItem(),
|
getCloudflareConnectionListItem(),
|
||||||
@@ -316,6 +322,7 @@ export const validateAppConnectionCredentials = async (
|
|||||||
[AppConnection.OnePass]: validateOnePassConnectionCredentials as TAppConnectionCredentialsValidator,
|
[AppConnection.OnePass]: validateOnePassConnectionCredentials as TAppConnectionCredentialsValidator,
|
||||||
[AppConnection.Heroku]: validateHerokuConnectionCredentials as TAppConnectionCredentialsValidator,
|
[AppConnection.Heroku]: validateHerokuConnectionCredentials as TAppConnectionCredentialsValidator,
|
||||||
[AppConnection.Render]: validateRenderConnectionCredentials as TAppConnectionCredentialsValidator,
|
[AppConnection.Render]: validateRenderConnectionCredentials as TAppConnectionCredentialsValidator,
|
||||||
|
[AppConnection.LaravelForge]: validateLaravelForgeConnectionCredentials as TAppConnectionCredentialsValidator,
|
||||||
[AppConnection.Flyio]: validateFlyioConnectionCredentials as TAppConnectionCredentialsValidator,
|
[AppConnection.Flyio]: validateFlyioConnectionCredentials as TAppConnectionCredentialsValidator,
|
||||||
[AppConnection.GitLab]: validateGitLabConnectionCredentials as TAppConnectionCredentialsValidator,
|
[AppConnection.GitLab]: validateGitLabConnectionCredentials as TAppConnectionCredentialsValidator,
|
||||||
[AppConnection.Cloudflare]: validateCloudflareConnectionCredentials as TAppConnectionCredentialsValidator,
|
[AppConnection.Cloudflare]: validateCloudflareConnectionCredentials as TAppConnectionCredentialsValidator,
|
||||||
@@ -368,6 +375,7 @@ export const getAppConnectionMethodName = (method: TAppConnection["method"]) =>
|
|||||||
case ZabbixConnectionMethod.ApiToken:
|
case ZabbixConnectionMethod.ApiToken:
|
||||||
case DigitalOceanConnectionMethod.ApiToken:
|
case DigitalOceanConnectionMethod.ApiToken:
|
||||||
case OktaConnectionMethod.ApiToken:
|
case OktaConnectionMethod.ApiToken:
|
||||||
|
case LaravelForgeConnectionMethod.ApiToken:
|
||||||
return "API Token";
|
return "API Token";
|
||||||
case PostgresConnectionMethod.UsernameAndPassword:
|
case PostgresConnectionMethod.UsernameAndPassword:
|
||||||
case MsSqlConnectionMethod.UsernameAndPassword:
|
case MsSqlConnectionMethod.UsernameAndPassword:
|
||||||
@@ -463,7 +471,8 @@ export const TRANSITION_CONNECTION_CREDENTIALS_TO_PLATFORM: Record<
|
|||||||
[AppConnection.DigitalOcean]: platformManagedCredentialsNotSupported,
|
[AppConnection.DigitalOcean]: platformManagedCredentialsNotSupported,
|
||||||
[AppConnection.Netlify]: platformManagedCredentialsNotSupported,
|
[AppConnection.Netlify]: platformManagedCredentialsNotSupported,
|
||||||
[AppConnection.Okta]: platformManagedCredentialsNotSupported,
|
[AppConnection.Okta]: platformManagedCredentialsNotSupported,
|
||||||
[AppConnection.Redis]: platformManagedCredentialsNotSupported
|
[AppConnection.Redis]: platformManagedCredentialsNotSupported,
|
||||||
|
[AppConnection.LaravelForge]: platformManagedCredentialsNotSupported
|
||||||
};
|
};
|
||||||
|
|
||||||
export const enterpriseAppCheck = async (
|
export const enterpriseAppCheck = async (
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ export const APP_CONNECTION_NAME_MAP: Record<AppConnection, string> = {
|
|||||||
[AppConnection.OnePass]: "1Password",
|
[AppConnection.OnePass]: "1Password",
|
||||||
[AppConnection.Heroku]: "Heroku",
|
[AppConnection.Heroku]: "Heroku",
|
||||||
[AppConnection.Render]: "Render",
|
[AppConnection.Render]: "Render",
|
||||||
|
[AppConnection.LaravelForge]: "Laravel Forge",
|
||||||
[AppConnection.Flyio]: "Fly.io",
|
[AppConnection.Flyio]: "Fly.io",
|
||||||
[AppConnection.GitLab]: "GitLab",
|
[AppConnection.GitLab]: "GitLab",
|
||||||
[AppConnection.Cloudflare]: "Cloudflare",
|
[AppConnection.Cloudflare]: "Cloudflare",
|
||||||
@@ -70,6 +71,7 @@ export const APP_CONNECTION_PLAN_MAP: Record<AppConnection, AppConnectionPlanTyp
|
|||||||
[AppConnection.MySql]: AppConnectionPlanType.Regular,
|
[AppConnection.MySql]: AppConnectionPlanType.Regular,
|
||||||
[AppConnection.Heroku]: AppConnectionPlanType.Regular,
|
[AppConnection.Heroku]: AppConnectionPlanType.Regular,
|
||||||
[AppConnection.Render]: AppConnectionPlanType.Regular,
|
[AppConnection.Render]: AppConnectionPlanType.Regular,
|
||||||
|
[AppConnection.LaravelForge]: AppConnectionPlanType.Regular,
|
||||||
[AppConnection.Flyio]: AppConnectionPlanType.Regular,
|
[AppConnection.Flyio]: AppConnectionPlanType.Regular,
|
||||||
[AppConnection.GitLab]: AppConnectionPlanType.Regular,
|
[AppConnection.GitLab]: AppConnectionPlanType.Regular,
|
||||||
[AppConnection.Cloudflare]: AppConnectionPlanType.Regular,
|
[AppConnection.Cloudflare]: AppConnectionPlanType.Regular,
|
||||||
|
|||||||
@@ -89,6 +89,8 @@ import { ValidateHerokuConnectionCredentialsSchema } from "./heroku";
|
|||||||
import { herokuConnectionService } from "./heroku/heroku-connection-service";
|
import { herokuConnectionService } from "./heroku/heroku-connection-service";
|
||||||
import { ValidateHumanitecConnectionCredentialsSchema } from "./humanitec";
|
import { ValidateHumanitecConnectionCredentialsSchema } from "./humanitec";
|
||||||
import { humanitecConnectionService } from "./humanitec/humanitec-connection-service";
|
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 { ValidateLdapConnectionCredentialsSchema } from "./ldap";
|
||||||
import { ValidateMsSqlConnectionCredentialsSchema } from "./mssql";
|
import { ValidateMsSqlConnectionCredentialsSchema } from "./mssql";
|
||||||
import { ValidateMySqlConnectionCredentialsSchema } from "./mysql";
|
import { ValidateMySqlConnectionCredentialsSchema } from "./mysql";
|
||||||
@@ -157,6 +159,7 @@ const VALIDATE_APP_CONNECTION_CREDENTIALS_MAP: Record<AppConnection, TValidateAp
|
|||||||
[AppConnection.OnePass]: ValidateOnePassConnectionCredentialsSchema,
|
[AppConnection.OnePass]: ValidateOnePassConnectionCredentialsSchema,
|
||||||
[AppConnection.Heroku]: ValidateHerokuConnectionCredentialsSchema,
|
[AppConnection.Heroku]: ValidateHerokuConnectionCredentialsSchema,
|
||||||
[AppConnection.Render]: ValidateRenderConnectionCredentialsSchema,
|
[AppConnection.Render]: ValidateRenderConnectionCredentialsSchema,
|
||||||
|
[AppConnection.LaravelForge]: ValidateLaravelForgeConnectionCredentialsSchema,
|
||||||
[AppConnection.Flyio]: ValidateFlyioConnectionCredentialsSchema,
|
[AppConnection.Flyio]: ValidateFlyioConnectionCredentialsSchema,
|
||||||
[AppConnection.GitLab]: ValidateGitLabConnectionCredentialsSchema,
|
[AppConnection.GitLab]: ValidateGitLabConnectionCredentialsSchema,
|
||||||
[AppConnection.Cloudflare]: ValidateCloudflareConnectionCredentialsSchema,
|
[AppConnection.Cloudflare]: ValidateCloudflareConnectionCredentialsSchema,
|
||||||
@@ -864,6 +867,7 @@ export const appConnectionServiceFactory = ({
|
|||||||
supabase: supabaseConnectionService(connectAppConnectionById),
|
supabase: supabaseConnectionService(connectAppConnectionById),
|
||||||
digitalOcean: digitalOceanAppPlatformConnectionService(connectAppConnectionById),
|
digitalOcean: digitalOceanAppPlatformConnectionService(connectAppConnectionById),
|
||||||
netlify: netlifyConnectionService(connectAppConnectionById),
|
netlify: netlifyConnectionService(connectAppConnectionById),
|
||||||
okta: oktaConnectionService(connectAppConnectionById)
|
okta: oktaConnectionService(connectAppConnectionById),
|
||||||
|
laravelForge: laravelForgeConnectionService(connectAppConnectionById)
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -148,6 +148,12 @@ import {
|
|||||||
THumanitecConnectionInput,
|
THumanitecConnectionInput,
|
||||||
TValidateHumanitecConnectionCredentialsSchema
|
TValidateHumanitecConnectionCredentialsSchema
|
||||||
} from "./humanitec";
|
} from "./humanitec";
|
||||||
|
import {
|
||||||
|
TLaravelForgeConnection,
|
||||||
|
TLaravelForgeConnectionConfig,
|
||||||
|
TLaravelForgeConnectionInput,
|
||||||
|
TValidateLaravelForgeConnectionCredentialsSchema
|
||||||
|
} from "./laravel-forge";
|
||||||
import {
|
import {
|
||||||
TLdapConnection,
|
TLdapConnection,
|
||||||
TLdapConnectionConfig,
|
TLdapConnectionConfig,
|
||||||
@@ -256,6 +262,7 @@ export type TAppConnection = { id: string } & (
|
|||||||
| TOnePassConnection
|
| TOnePassConnection
|
||||||
| THerokuConnection
|
| THerokuConnection
|
||||||
| TRenderConnection
|
| TRenderConnection
|
||||||
|
| TLaravelForgeConnection
|
||||||
| TFlyioConnection
|
| TFlyioConnection
|
||||||
| TGitLabConnection
|
| TGitLabConnection
|
||||||
| TCloudflareConnection
|
| TCloudflareConnection
|
||||||
@@ -302,6 +309,7 @@ export type TAppConnectionInput = { id: string } & (
|
|||||||
| TOnePassConnectionInput
|
| TOnePassConnectionInput
|
||||||
| THerokuConnectionInput
|
| THerokuConnectionInput
|
||||||
| TRenderConnectionInput
|
| TRenderConnectionInput
|
||||||
|
| TLaravelForgeConnectionInput
|
||||||
| TFlyioConnectionInput
|
| TFlyioConnectionInput
|
||||||
| TGitLabConnectionInput
|
| TGitLabConnectionInput
|
||||||
| TCloudflareConnectionInput
|
| TCloudflareConnectionInput
|
||||||
@@ -366,6 +374,7 @@ export type TAppConnectionConfig =
|
|||||||
| TOnePassConnectionConfig
|
| TOnePassConnectionConfig
|
||||||
| THerokuConnectionConfig
|
| THerokuConnectionConfig
|
||||||
| TRenderConnectionConfig
|
| TRenderConnectionConfig
|
||||||
|
| TLaravelForgeConnectionConfig
|
||||||
| TFlyioConnectionConfig
|
| TFlyioConnectionConfig
|
||||||
| TGitLabConnectionConfig
|
| TGitLabConnectionConfig
|
||||||
| TCloudflareConnectionConfig
|
| TCloudflareConnectionConfig
|
||||||
@@ -407,6 +416,7 @@ export type TValidateAppConnectionCredentialsSchema =
|
|||||||
| TValidateOnePassConnectionCredentialsSchema
|
| TValidateOnePassConnectionCredentialsSchema
|
||||||
| TValidateHerokuConnectionCredentialsSchema
|
| TValidateHerokuConnectionCredentialsSchema
|
||||||
| TValidateRenderConnectionCredentialsSchema
|
| TValidateRenderConnectionCredentialsSchema
|
||||||
|
| TValidateLaravelForgeConnectionCredentialsSchema
|
||||||
| TValidateFlyioConnectionCredentialsSchema
|
| TValidateFlyioConnectionCredentialsSchema
|
||||||
| TValidateGitLabConnectionCredentialsSchema
|
| TValidateGitLabConnectionCredentialsSchema
|
||||||
| TValidateCloudflareConnectionCredentialsSchema
|
| TValidateCloudflareConnectionCredentialsSchema
|
||||||
|
|||||||
@@ -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";
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
export enum LaravelForgeConnectionMethod {
|
||||||
|
ApiToken = "api-token"
|
||||||
|
}
|
||||||
@@ -0,0 +1,165 @@
|
|||||||
|
/* eslint-disable no-await-in-loop */
|
||||||
|
import { AxiosError } from "axios";
|
||||||
|
|
||||||
|
import { request } from "@app/lib/config/request";
|
||||||
|
import { BadRequestError, InternalServerError } 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 {
|
||||||
|
TLaravelForgeConnection,
|
||||||
|
TLaravelForgeConnectionConfig,
|
||||||
|
TLaravelForgeOrganization,
|
||||||
|
TLaravelForgeServer,
|
||||||
|
TLaravelForgeSite,
|
||||||
|
TRawLaravelForgeOrganization,
|
||||||
|
TRawLaravelForgeServer,
|
||||||
|
TRawLaravelForgeSite
|
||||||
|
} 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;
|
||||||
|
};
|
||||||
|
|
||||||
|
type TLaravelForgeApiResponse<T> = {
|
||||||
|
data: T[];
|
||||||
|
links?: {
|
||||||
|
next?: string;
|
||||||
|
};
|
||||||
|
meta?: {
|
||||||
|
next_cursor?: string;
|
||||||
|
prev_cursor?: string | null;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
const fetchAllPages = async <T>(
|
||||||
|
apiToken: string,
|
||||||
|
url: string,
|
||||||
|
params?: Record<string, string | number>
|
||||||
|
): Promise<T[]> => {
|
||||||
|
const allItems: T[] = [];
|
||||||
|
let nextUrl: string | null = url;
|
||||||
|
const queryParams = params || {};
|
||||||
|
|
||||||
|
while (nextUrl) {
|
||||||
|
try {
|
||||||
|
const response: { data: TLaravelForgeApiResponse<T> } = await request.get<TLaravelForgeApiResponse<T>>(nextUrl, {
|
||||||
|
params: queryParams,
|
||||||
|
headers: {
|
||||||
|
Authorization: `Bearer ${apiToken}`,
|
||||||
|
Accept: "application/json",
|
||||||
|
"Content-Type": "application/json"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!response?.data?.data) {
|
||||||
|
throw new InternalServerError({
|
||||||
|
message: `Failed to fetch data from ${url}: Response was empty or malformed`
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
allItems.push(...response.data.data);
|
||||||
|
|
||||||
|
if (response.data.links?.next) {
|
||||||
|
nextUrl = response.data.links.next;
|
||||||
|
} else {
|
||||||
|
nextUrl = null;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
if (error instanceof AxiosError) {
|
||||||
|
throw new BadRequestError({
|
||||||
|
message: `Failed to fetch data from ${url}: ${error.message || "Unknown error"}`
|
||||||
|
});
|
||||||
|
}
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return allItems;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const listLaravelForgeOrganizations = async (
|
||||||
|
appConnection: TLaravelForgeConnection
|
||||||
|
): Promise<TLaravelForgeOrganization[]> => {
|
||||||
|
const { credentials } = appConnection;
|
||||||
|
const { apiToken } = credentials;
|
||||||
|
|
||||||
|
const rawOrganizations = await fetchAllPages<TRawLaravelForgeOrganization>(
|
||||||
|
apiToken,
|
||||||
|
`${IntegrationUrls.LARAVELFORGE_API_URL}/api/orgs`
|
||||||
|
);
|
||||||
|
|
||||||
|
return rawOrganizations.map((org: TRawLaravelForgeOrganization) => ({
|
||||||
|
id: org.id,
|
||||||
|
name: org.attributes.name,
|
||||||
|
slug: org.attributes.slug
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
|
||||||
|
export const listLaravelForgeServers = async (
|
||||||
|
appConnection: TLaravelForgeConnection,
|
||||||
|
organizationSlug: string
|
||||||
|
): Promise<TLaravelForgeServer[]> => {
|
||||||
|
const { credentials } = appConnection;
|
||||||
|
const { apiToken } = credentials;
|
||||||
|
|
||||||
|
const rawServers = await fetchAllPages<TRawLaravelForgeServer>(
|
||||||
|
apiToken,
|
||||||
|
`${IntegrationUrls.LARAVELFORGE_API_URL}/api/orgs/${organizationSlug}/servers`
|
||||||
|
);
|
||||||
|
|
||||||
|
return rawServers.map((server: TRawLaravelForgeServer) => ({
|
||||||
|
id: server.id,
|
||||||
|
name: server.attributes.name
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
|
||||||
|
export const listLaravelForgeSites = async (
|
||||||
|
appConnection: TLaravelForgeConnection,
|
||||||
|
organizationSlug: string,
|
||||||
|
serverId: string
|
||||||
|
): Promise<TLaravelForgeSite[]> => {
|
||||||
|
const { credentials } = appConnection;
|
||||||
|
const { apiToken } = credentials;
|
||||||
|
|
||||||
|
const rawSites = await fetchAllPages<TRawLaravelForgeSite>(
|
||||||
|
apiToken,
|
||||||
|
`${IntegrationUrls.LARAVELFORGE_API_URL}/api/orgs/${organizationSlug}/servers/${serverId}/sites`
|
||||||
|
);
|
||||||
|
|
||||||
|
return rawSites.map((site: TRawLaravelForgeSite) => ({
|
||||||
|
id: site.id,
|
||||||
|
name: site.attributes.name
|
||||||
|
}));
|
||||||
|
};
|
||||||
@@ -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()
|
||||||
|
});
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
import { logger } from "@app/lib/logger";
|
||||||
|
import { OrgServiceActor } from "@app/lib/types";
|
||||||
|
|
||||||
|
import { AppConnection } from "../app-connection-enums";
|
||||||
|
import {
|
||||||
|
listLaravelForgeOrganizations,
|
||||||
|
listLaravelForgeServers,
|
||||||
|
listLaravelForgeSites
|
||||||
|
} from "./laravel-forge-connection-fns";
|
||||||
|
import {
|
||||||
|
TLaravelForgeConnection,
|
||||||
|
TLaravelForgeOrganization,
|
||||||
|
TLaravelForgeServer,
|
||||||
|
TLaravelForgeSite
|
||||||
|
} from "./laravel-forge-connection-types";
|
||||||
|
|
||||||
|
type TGetAppConnectionFunc = (
|
||||||
|
app: AppConnection,
|
||||||
|
connectionId: string,
|
||||||
|
actor: OrgServiceActor
|
||||||
|
) => Promise<TLaravelForgeConnection>;
|
||||||
|
|
||||||
|
export const laravelForgeConnectionService = (getAppConnection: TGetAppConnectionFunc) => {
|
||||||
|
const listOrganizations = async (
|
||||||
|
connectionId: string,
|
||||||
|
actor: OrgServiceActor
|
||||||
|
): Promise<TLaravelForgeOrganization[]> => {
|
||||||
|
const appConnection = await getAppConnection(AppConnection.LaravelForge, connectionId, actor);
|
||||||
|
try {
|
||||||
|
const organizations = await listLaravelForgeOrganizations(appConnection);
|
||||||
|
return organizations;
|
||||||
|
} catch (error) {
|
||||||
|
logger.error(error, "Failed to list organizations for Laravel Forge connection");
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const listServers = async (
|
||||||
|
connectionId: string,
|
||||||
|
actor: OrgServiceActor,
|
||||||
|
organizationSlug: string
|
||||||
|
): Promise<TLaravelForgeServer[]> => {
|
||||||
|
const appConnection = await getAppConnection(AppConnection.LaravelForge, connectionId, actor);
|
||||||
|
try {
|
||||||
|
const servers = await listLaravelForgeServers(appConnection, organizationSlug);
|
||||||
|
return servers;
|
||||||
|
} catch (error) {
|
||||||
|
logger.error(error, "Failed to list servers for Laravel Forge connection");
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const listSites = async (
|
||||||
|
connectionId: string,
|
||||||
|
actor: OrgServiceActor,
|
||||||
|
organizationSlug: string,
|
||||||
|
serverId: string
|
||||||
|
): Promise<TLaravelForgeSite[]> => {
|
||||||
|
const appConnection = await getAppConnection(AppConnection.LaravelForge, connectionId, actor);
|
||||||
|
try {
|
||||||
|
const sites = await listLaravelForgeSites(appConnection, organizationSlug, serverId);
|
||||||
|
return sites;
|
||||||
|
} catch (error) {
|
||||||
|
logger.error(error, "Failed to list sites for Laravel Forge connection");
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
listOrganizations,
|
||||||
|
listServers,
|
||||||
|
listSites
|
||||||
|
};
|
||||||
|
};
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
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"
|
||||||
|
> & {
|
||||||
|
orgSlug: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type TLaravelForgeOrganization = {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
slug: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type TLaravelForgeServer = {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type TLaravelForgeSite = {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type TRawLaravelForgeOrganization = {
|
||||||
|
id: string;
|
||||||
|
attributes: {
|
||||||
|
name: string;
|
||||||
|
slug: string;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export type TRawLaravelForgeServer = {
|
||||||
|
id: string;
|
||||||
|
attributes: {
|
||||||
|
name: string;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export type TRawLaravelForgeSite = {
|
||||||
|
id: string;
|
||||||
|
attributes: {
|
||||||
|
name: string;
|
||||||
|
};
|
||||||
|
};
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
export * from "./laravel-forge-sync-constants";
|
||||||
|
export * from "./laravel-forge-sync-fns";
|
||||||
|
export * from "./laravel-forge-sync-schemas";
|
||||||
|
export * from "./laravel-forge-sync-types";
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
import { AppConnection } from "@app/services/app-connection/app-connection-enums";
|
||||||
|
import { SecretSync } from "@app/services/secret-sync/secret-sync-enums";
|
||||||
|
import { TSecretSyncListItem } from "@app/services/secret-sync/secret-sync-types";
|
||||||
|
|
||||||
|
export const LARAVEL_FORGE_SYNC_LIST_OPTION: TSecretSyncListItem = {
|
||||||
|
name: "Laravel Forge",
|
||||||
|
destination: SecretSync.LaravelForge,
|
||||||
|
connection: AppConnection.LaravelForge,
|
||||||
|
canImportSecrets: true
|
||||||
|
};
|
||||||
@@ -0,0 +1,207 @@
|
|||||||
|
import { request } from "@app/lib/config/request";
|
||||||
|
import { IntegrationUrls } from "@app/services/integration-auth/integration-list";
|
||||||
|
import { matchesSchema } from "@app/services/secret-sync/secret-sync-fns";
|
||||||
|
import { TSecretMap } from "@app/services/secret-sync/secret-sync-types";
|
||||||
|
|
||||||
|
import {
|
||||||
|
LaravelForgeSecret,
|
||||||
|
TGetLaravelForgeSecrets,
|
||||||
|
TLaravelForgeSecrets,
|
||||||
|
TLaravelForgeSyncWithCredentials
|
||||||
|
} from "./laravel-forge-sync-types";
|
||||||
|
|
||||||
|
const getLaravelForgeSecretsRaw = async ({ apiToken, orgSlug, serverId, siteId }: TGetLaravelForgeSecrets) => {
|
||||||
|
const { data } = await request.get<TLaravelForgeSecrets>(
|
||||||
|
`${IntegrationUrls.LARAVELFORGE_API_URL}/api/orgs/${orgSlug}/servers/${serverId}/sites/${siteId}/environment`,
|
||||||
|
{
|
||||||
|
headers: {
|
||||||
|
Authorization: `Bearer ${apiToken}`,
|
||||||
|
Accept: "application/json",
|
||||||
|
"Content-Type": "application/json"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return data.data.attributes.content;
|
||||||
|
};
|
||||||
|
|
||||||
|
const parseEnv = (str: string) => {
|
||||||
|
const lines = str.split("\n");
|
||||||
|
const parsed: { key: string; value: string }[] = [];
|
||||||
|
|
||||||
|
let i = 0;
|
||||||
|
while (i < lines.length) {
|
||||||
|
const trimmed = lines[i].trim();
|
||||||
|
|
||||||
|
// Skip empty lines and comments
|
||||||
|
if (trimmed === "" || trimmed.startsWith("#")) {
|
||||||
|
i += 1;
|
||||||
|
// eslint-disable-next-line no-continue
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (trimmed.includes("=")) {
|
||||||
|
const equalIndex = trimmed.indexOf("=");
|
||||||
|
const key = trimmed.substring(0, equalIndex).trim();
|
||||||
|
const valueRaw = trimmed.substring(equalIndex + 1).trim();
|
||||||
|
|
||||||
|
// Check if value starts with a quote
|
||||||
|
const startsWithDoubleQuote = valueRaw.startsWith('"');
|
||||||
|
const startsWithSingleQuote = valueRaw.startsWith("'");
|
||||||
|
|
||||||
|
if (startsWithDoubleQuote || startsWithSingleQuote) {
|
||||||
|
const quoteChar = startsWithDoubleQuote ? '"' : "'";
|
||||||
|
|
||||||
|
const closingQuoteIndex = valueRaw.indexOf(quoteChar, 1);
|
||||||
|
|
||||||
|
if (closingQuoteIndex !== -1) {
|
||||||
|
// Single-line quoted value
|
||||||
|
const value = valueRaw.slice(1, closingQuoteIndex);
|
||||||
|
parsed.push({ key, value });
|
||||||
|
i += 1;
|
||||||
|
} else {
|
||||||
|
// Multiline quoted value - collect lines until closing quote
|
||||||
|
let value = valueRaw.slice(1);
|
||||||
|
i += 1;
|
||||||
|
|
||||||
|
while (i < lines.length) {
|
||||||
|
const nextLine = lines[i];
|
||||||
|
const closingIndex = nextLine.indexOf(quoteChar);
|
||||||
|
|
||||||
|
if (closingIndex !== -1) {
|
||||||
|
value += `\n${nextLine.substring(0, closingIndex)}`;
|
||||||
|
parsed.push({ key, value });
|
||||||
|
i += 1;
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
value += `\n${nextLine}`;
|
||||||
|
i += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Unquoted value
|
||||||
|
parsed.push({ key, value: valueRaw });
|
||||||
|
i += 1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
i += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return parsed;
|
||||||
|
};
|
||||||
|
|
||||||
|
const getLaravelForgeSecrets = async (secretSync: TLaravelForgeSyncWithCredentials): Promise<LaravelForgeSecret[]> => {
|
||||||
|
const {
|
||||||
|
connection,
|
||||||
|
destinationConfig: { orgSlug, serverId, siteId }
|
||||||
|
} = secretSync;
|
||||||
|
|
||||||
|
const { apiToken } = connection.credentials;
|
||||||
|
|
||||||
|
const secrets = await getLaravelForgeSecretsRaw({ apiToken, orgSlug, serverId, siteId });
|
||||||
|
|
||||||
|
const parsedSecrets = parseEnv(secrets);
|
||||||
|
|
||||||
|
return parsedSecrets;
|
||||||
|
};
|
||||||
|
|
||||||
|
const buildEnvString = (secrets: LaravelForgeSecret[]) => {
|
||||||
|
if (secrets.length === 0) {
|
||||||
|
return "# .env";
|
||||||
|
}
|
||||||
|
|
||||||
|
return secrets
|
||||||
|
.map((secret) => {
|
||||||
|
const { value } = secret;
|
||||||
|
|
||||||
|
if (value.includes(`"`)) {
|
||||||
|
return `${secret.key}='${value}'`;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (value.includes(" ") || value.includes("\n") || value.includes(`'`)) {
|
||||||
|
return `${secret.key}="${value}"`;
|
||||||
|
}
|
||||||
|
return `${secret.key}=${value}`;
|
||||||
|
})
|
||||||
|
.join("\n");
|
||||||
|
};
|
||||||
|
|
||||||
|
const updateLaravelForgeSecrets = async (secretSync: TLaravelForgeSyncWithCredentials, envString: string) => {
|
||||||
|
const {
|
||||||
|
connection,
|
||||||
|
destinationConfig: { orgSlug, serverId, siteId }
|
||||||
|
} = secretSync;
|
||||||
|
|
||||||
|
const { apiToken } = connection.credentials;
|
||||||
|
|
||||||
|
await request.put(
|
||||||
|
`${IntegrationUrls.LARAVELFORGE_API_URL}/api/orgs/${orgSlug}/servers/${serverId}/sites/${siteId}/environment`,
|
||||||
|
{
|
||||||
|
environment: envString
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
headers: {
|
||||||
|
Authorization: `Bearer ${apiToken}`,
|
||||||
|
Accept: "application/json",
|
||||||
|
"Content-Type": "application/json"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const LaravelForgeSyncFns = {
|
||||||
|
async syncSecrets(secretSync: TLaravelForgeSyncWithCredentials, secretMap: TSecretMap) {
|
||||||
|
const {
|
||||||
|
environment,
|
||||||
|
syncOptions: { disableSecretDeletion, keySchema }
|
||||||
|
} = secretSync;
|
||||||
|
|
||||||
|
const secrets = await getLaravelForgeSecrets(secretSync);
|
||||||
|
|
||||||
|
// Create a map of the existing secrets
|
||||||
|
const updatedSecretsMap = new Map(secrets.map((secret) => [secret.key, secret.value]));
|
||||||
|
|
||||||
|
for (const [key, { value }] of Object.entries(secretMap)) {
|
||||||
|
// Add the new secrets to the map
|
||||||
|
updatedSecretsMap.set(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!disableSecretDeletion) {
|
||||||
|
secrets.forEach((secret) => {
|
||||||
|
if (!matchesSchema(secret.key, environment?.slug || "", keySchema)) return;
|
||||||
|
|
||||||
|
if (!secretMap[secret.key]) {
|
||||||
|
updatedSecretsMap.delete(secret.key);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const updatedSecrets = Array.from(updatedSecretsMap.entries()).map(([key, value]) => ({ key, value }));
|
||||||
|
|
||||||
|
const envString = buildEnvString(updatedSecrets);
|
||||||
|
|
||||||
|
await updateLaravelForgeSecrets(secretSync, envString);
|
||||||
|
},
|
||||||
|
|
||||||
|
async getSecrets(secretSync: TLaravelForgeSyncWithCredentials): Promise<TSecretMap> {
|
||||||
|
const secrets = await getLaravelForgeSecrets(secretSync);
|
||||||
|
return Object.fromEntries(secrets.map((secret) => [secret.key, { value: secret.value }]));
|
||||||
|
},
|
||||||
|
|
||||||
|
async removeSecrets(secretSync: TLaravelForgeSyncWithCredentials, secretMap: TSecretMap) {
|
||||||
|
const existingSecrets = await getLaravelForgeSecrets(secretSync);
|
||||||
|
|
||||||
|
const newSecrets = existingSecrets.filter((secret) => !Object.hasOwn(secretMap, secret.key));
|
||||||
|
|
||||||
|
if (newSecrets.length === existingSecrets.length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const envString = buildEnvString(newSecrets);
|
||||||
|
|
||||||
|
await updateLaravelForgeSecrets(secretSync, envString);
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
import RE2 from "re2";
|
||||||
|
import { z } from "zod";
|
||||||
|
|
||||||
|
import { SecretSyncs } from "@app/lib/api-docs";
|
||||||
|
import { AppConnection } from "@app/services/app-connection/app-connection-enums";
|
||||||
|
import { SecretSync } from "@app/services/secret-sync/secret-sync-enums";
|
||||||
|
import {
|
||||||
|
BaseSecretSyncSchema,
|
||||||
|
GenericCreateSecretSyncFieldsSchema,
|
||||||
|
GenericUpdateSecretSyncFieldsSchema
|
||||||
|
} from "@app/services/secret-sync/secret-sync-schemas";
|
||||||
|
import { TSyncOptionsConfig } from "@app/services/secret-sync/secret-sync-types";
|
||||||
|
|
||||||
|
const slugValidator = (val: string) => {
|
||||||
|
return new RE2("^[a-z0-9.-]+$").test(val) && !new RE2(".[-]$").test(val);
|
||||||
|
};
|
||||||
|
|
||||||
|
const LaravelForgeSyncDestinationConfigSchema = z.object({
|
||||||
|
orgSlug: z
|
||||||
|
.string()
|
||||||
|
.min(1, "Org Slug is required")
|
||||||
|
.max(512, "Org Slug cannot exceed 512 characters")
|
||||||
|
.refine(
|
||||||
|
(val) => slugValidator(val),
|
||||||
|
"Org Slug can only contain lowercase letters, numbers, dots, and dashes, and cannot end with a dot or dash."
|
||||||
|
)
|
||||||
|
.describe(SecretSyncs.DESTINATION_CONFIG.LARAVEL_FORGE.orgSlug),
|
||||||
|
orgName: z.string().optional().describe(SecretSyncs.DESTINATION_CONFIG.LARAVEL_FORGE.orgName),
|
||||||
|
serverId: z
|
||||||
|
.string()
|
||||||
|
.min(1, "Server ID is required")
|
||||||
|
.refine((val) => !Number.isNaN(Number(val)), "Server ID must be a valid integer")
|
||||||
|
.describe(SecretSyncs.DESTINATION_CONFIG.LARAVEL_FORGE.serverId),
|
||||||
|
serverName: z.string().optional().describe(SecretSyncs.DESTINATION_CONFIG.LARAVEL_FORGE.serverName),
|
||||||
|
siteId: z.string().min(1, "Site ID is required").describe(SecretSyncs.DESTINATION_CONFIG.LARAVEL_FORGE.siteId),
|
||||||
|
siteName: z.string().optional().describe(SecretSyncs.DESTINATION_CONFIG.LARAVEL_FORGE.siteName)
|
||||||
|
});
|
||||||
|
|
||||||
|
const LaravelForgeSyncOptionsConfig: TSyncOptionsConfig = { canImportSecrets: true };
|
||||||
|
|
||||||
|
export const LaravelForgeSyncSchema = BaseSecretSyncSchema(
|
||||||
|
SecretSync.LaravelForge,
|
||||||
|
LaravelForgeSyncOptionsConfig
|
||||||
|
).extend({
|
||||||
|
destination: z.literal(SecretSync.LaravelForge),
|
||||||
|
destinationConfig: LaravelForgeSyncDestinationConfigSchema
|
||||||
|
});
|
||||||
|
|
||||||
|
export const CreateLaravelForgeSyncSchema = GenericCreateSecretSyncFieldsSchema(
|
||||||
|
SecretSync.LaravelForge,
|
||||||
|
LaravelForgeSyncOptionsConfig
|
||||||
|
).extend({
|
||||||
|
destinationConfig: LaravelForgeSyncDestinationConfigSchema
|
||||||
|
});
|
||||||
|
|
||||||
|
export const UpdateLaravelForgeSyncSchema = GenericUpdateSecretSyncFieldsSchema(
|
||||||
|
SecretSync.LaravelForge,
|
||||||
|
LaravelForgeSyncOptionsConfig
|
||||||
|
).extend({
|
||||||
|
destinationConfig: LaravelForgeSyncDestinationConfigSchema.optional()
|
||||||
|
});
|
||||||
|
|
||||||
|
export const LaravelForgeSyncListItemSchema = z.object({
|
||||||
|
name: z.literal("Laravel Forge"),
|
||||||
|
connection: z.literal(AppConnection.LaravelForge),
|
||||||
|
destination: z.literal(SecretSync.LaravelForge),
|
||||||
|
canImportSecrets: z.literal(true)
|
||||||
|
});
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
import z from "zod";
|
||||||
|
|
||||||
|
import { TLaravelForgeConnection } from "@app/services/app-connection/laravel-forge";
|
||||||
|
|
||||||
|
import {
|
||||||
|
CreateLaravelForgeSyncSchema,
|
||||||
|
LaravelForgeSyncListItemSchema,
|
||||||
|
LaravelForgeSyncSchema
|
||||||
|
} from "./laravel-forge-sync-schemas";
|
||||||
|
|
||||||
|
export type TLaravelForgeSyncListItem = z.infer<typeof LaravelForgeSyncListItemSchema>;
|
||||||
|
|
||||||
|
export type TLaravelForgeSync = z.infer<typeof LaravelForgeSyncSchema>;
|
||||||
|
|
||||||
|
export type TLaravelForgeSyncInput = z.infer<typeof CreateLaravelForgeSyncSchema>;
|
||||||
|
|
||||||
|
export type TLaravelForgeSyncWithCredentials = TLaravelForgeSync & {
|
||||||
|
connection: TLaravelForgeConnection;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type TGetLaravelForgeSecrets = {
|
||||||
|
apiToken: string;
|
||||||
|
orgSlug: string;
|
||||||
|
serverId: string;
|
||||||
|
siteId: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type TLaravelForgeSecrets = {
|
||||||
|
data: {
|
||||||
|
id: string;
|
||||||
|
type: string;
|
||||||
|
attributes: {
|
||||||
|
content: string;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export type LaravelForgeSecret = {
|
||||||
|
key: string;
|
||||||
|
value: string;
|
||||||
|
};
|
||||||
@@ -28,7 +28,8 @@ export enum SecretSync {
|
|||||||
Checkly = "checkly",
|
Checkly = "checkly",
|
||||||
DigitalOceanAppPlatform = "digital-ocean-app-platform",
|
DigitalOceanAppPlatform = "digital-ocean-app-platform",
|
||||||
Netlify = "netlify",
|
Netlify = "netlify",
|
||||||
Bitbucket = "bitbucket"
|
Bitbucket = "bitbucket",
|
||||||
|
LaravelForge = "laravel-forge"
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum SecretSyncInitialSyncBehavior {
|
export enum SecretSyncInitialSyncBehavior {
|
||||||
|
|||||||
@@ -49,6 +49,8 @@ import { HC_VAULT_SYNC_LIST_OPTION, HCVaultSyncFns } from "./hc-vault";
|
|||||||
import { HEROKU_SYNC_LIST_OPTION, HerokuSyncFns } from "./heroku";
|
import { HEROKU_SYNC_LIST_OPTION, HerokuSyncFns } from "./heroku";
|
||||||
import { HUMANITEC_SYNC_LIST_OPTION } from "./humanitec";
|
import { HUMANITEC_SYNC_LIST_OPTION } from "./humanitec";
|
||||||
import { HumanitecSyncFns } from "./humanitec/humanitec-sync-fns";
|
import { HumanitecSyncFns } from "./humanitec/humanitec-sync-fns";
|
||||||
|
import { LARAVEL_FORGE_SYNC_LIST_OPTION } from "./laravel-forge";
|
||||||
|
import { LaravelForgeSyncFns } from "./laravel-forge/laravel-forge-sync-fns";
|
||||||
import { NETLIFY_SYNC_LIST_OPTION, NetlifySyncFns } from "./netlify";
|
import { NETLIFY_SYNC_LIST_OPTION, NetlifySyncFns } from "./netlify";
|
||||||
import { RAILWAY_SYNC_LIST_OPTION } from "./railway/railway-sync-constants";
|
import { RAILWAY_SYNC_LIST_OPTION } from "./railway/railway-sync-constants";
|
||||||
import { RailwaySyncFns } from "./railway/railway-sync-fns";
|
import { RailwaySyncFns } from "./railway/railway-sync-fns";
|
||||||
@@ -91,7 +93,8 @@ const SECRET_SYNC_LIST_OPTIONS: Record<SecretSync, TSecretSyncListItem> = {
|
|||||||
[SecretSync.Checkly]: CHECKLY_SYNC_LIST_OPTION,
|
[SecretSync.Checkly]: CHECKLY_SYNC_LIST_OPTION,
|
||||||
[SecretSync.DigitalOceanAppPlatform]: DIGITAL_OCEAN_APP_PLATFORM_SYNC_LIST_OPTION,
|
[SecretSync.DigitalOceanAppPlatform]: DIGITAL_OCEAN_APP_PLATFORM_SYNC_LIST_OPTION,
|
||||||
[SecretSync.Netlify]: NETLIFY_SYNC_LIST_OPTION,
|
[SecretSync.Netlify]: NETLIFY_SYNC_LIST_OPTION,
|
||||||
[SecretSync.Bitbucket]: BITBUCKET_SYNC_LIST_OPTION
|
[SecretSync.Bitbucket]: BITBUCKET_SYNC_LIST_OPTION,
|
||||||
|
[SecretSync.LaravelForge]: LARAVEL_FORGE_SYNC_LIST_OPTION
|
||||||
};
|
};
|
||||||
|
|
||||||
export const listSecretSyncOptions = () => {
|
export const listSecretSyncOptions = () => {
|
||||||
@@ -277,6 +280,8 @@ export const SecretSyncFns = {
|
|||||||
return NetlifySyncFns.syncSecrets(secretSync, schemaSecretMap);
|
return NetlifySyncFns.syncSecrets(secretSync, schemaSecretMap);
|
||||||
case SecretSync.Bitbucket:
|
case SecretSync.Bitbucket:
|
||||||
return BitbucketSyncFns.syncSecrets(secretSync, schemaSecretMap);
|
return BitbucketSyncFns.syncSecrets(secretSync, schemaSecretMap);
|
||||||
|
case SecretSync.LaravelForge:
|
||||||
|
return LaravelForgeSyncFns.syncSecrets(secretSync, schemaSecretMap);
|
||||||
default:
|
default:
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Unhandled sync destination for sync secrets fns: ${(secretSync as TSecretSyncWithCredentials).destination}`
|
`Unhandled sync destination for sync secrets fns: ${(secretSync as TSecretSyncWithCredentials).destination}`
|
||||||
@@ -393,6 +398,9 @@ export const SecretSyncFns = {
|
|||||||
case SecretSync.Bitbucket:
|
case SecretSync.Bitbucket:
|
||||||
secretMap = await BitbucketSyncFns.getSecrets(secretSync);
|
secretMap = await BitbucketSyncFns.getSecrets(secretSync);
|
||||||
break;
|
break;
|
||||||
|
case SecretSync.LaravelForge:
|
||||||
|
secretMap = await LaravelForgeSyncFns.getSecrets(secretSync);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Unhandled sync destination for get secrets fns: ${(secretSync as TSecretSyncWithCredentials).destination}`
|
`Unhandled sync destination for get secrets fns: ${(secretSync as TSecretSyncWithCredentials).destination}`
|
||||||
@@ -486,6 +494,8 @@ export const SecretSyncFns = {
|
|||||||
return NetlifySyncFns.removeSecrets(secretSync, schemaSecretMap);
|
return NetlifySyncFns.removeSecrets(secretSync, schemaSecretMap);
|
||||||
case SecretSync.Bitbucket:
|
case SecretSync.Bitbucket:
|
||||||
return BitbucketSyncFns.removeSecrets(secretSync, schemaSecretMap);
|
return BitbucketSyncFns.removeSecrets(secretSync, schemaSecretMap);
|
||||||
|
case SecretSync.LaravelForge:
|
||||||
|
return LaravelForgeSyncFns.removeSecrets(secretSync, schemaSecretMap);
|
||||||
default:
|
default:
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Unhandled sync destination for remove secrets fns: ${(secretSync as TSecretSyncWithCredentials).destination}`
|
`Unhandled sync destination for remove secrets fns: ${(secretSync as TSecretSyncWithCredentials).destination}`
|
||||||
|
|||||||
@@ -32,7 +32,8 @@ export const SECRET_SYNC_NAME_MAP: Record<SecretSync, string> = {
|
|||||||
[SecretSync.Checkly]: "Checkly",
|
[SecretSync.Checkly]: "Checkly",
|
||||||
[SecretSync.DigitalOceanAppPlatform]: "Digital Ocean App Platform",
|
[SecretSync.DigitalOceanAppPlatform]: "Digital Ocean App Platform",
|
||||||
[SecretSync.Netlify]: "Netlify",
|
[SecretSync.Netlify]: "Netlify",
|
||||||
[SecretSync.Bitbucket]: "Bitbucket"
|
[SecretSync.Bitbucket]: "Bitbucket",
|
||||||
|
[SecretSync.LaravelForge]: "Laravel Forge"
|
||||||
};
|
};
|
||||||
|
|
||||||
export const SECRET_SYNC_CONNECTION_MAP: Record<SecretSync, AppConnection> = {
|
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.Checkly]: AppConnection.Checkly,
|
||||||
[SecretSync.DigitalOceanAppPlatform]: AppConnection.DigitalOcean,
|
[SecretSync.DigitalOceanAppPlatform]: AppConnection.DigitalOcean,
|
||||||
[SecretSync.Netlify]: AppConnection.Netlify,
|
[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> = {
|
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.Checkly]: SecretSyncPlanType.Regular,
|
||||||
[SecretSync.DigitalOceanAppPlatform]: SecretSyncPlanType.Regular,
|
[SecretSync.DigitalOceanAppPlatform]: SecretSyncPlanType.Regular,
|
||||||
[SecretSync.Netlify]: 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[]> = {
|
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.Checkly]: ["groupName", "accountName"],
|
||||||
[SecretSync.DigitalOceanAppPlatform]: ["appName"],
|
[SecretSync.DigitalOceanAppPlatform]: ["appName"],
|
||||||
[SecretSync.Netlify]: ["accountName", "siteName"],
|
[SecretSync.Netlify]: ["accountName", "siteName"],
|
||||||
[SecretSync.Bitbucket]: []
|
[SecretSync.Bitbucket]: [],
|
||||||
|
[SecretSync.LaravelForge]: []
|
||||||
};
|
};
|
||||||
|
|
||||||
const defaultDuplicateCheck: DestinationDuplicateCheckFn = () => true;
|
const defaultDuplicateCheck: DestinationDuplicateCheckFn = () => true;
|
||||||
@@ -199,5 +203,6 @@ export const DESTINATION_DUPLICATE_CHECK_MAP: Record<SecretSync, DestinationDupl
|
|||||||
[SecretSync.Checkly]: defaultDuplicateCheck,
|
[SecretSync.Checkly]: defaultDuplicateCheck,
|
||||||
[SecretSync.DigitalOceanAppPlatform]: defaultDuplicateCheck,
|
[SecretSync.DigitalOceanAppPlatform]: defaultDuplicateCheck,
|
||||||
[SecretSync.Netlify]: defaultDuplicateCheck,
|
[SecretSync.Netlify]: defaultDuplicateCheck,
|
||||||
[SecretSync.Bitbucket]: defaultDuplicateCheck
|
[SecretSync.Bitbucket]: defaultDuplicateCheck,
|
||||||
|
[SecretSync.LaravelForge]: defaultDuplicateCheck
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -117,6 +117,12 @@ import {
|
|||||||
THumanitecSyncListItem,
|
THumanitecSyncListItem,
|
||||||
THumanitecSyncWithCredentials
|
THumanitecSyncWithCredentials
|
||||||
} from "./humanitec";
|
} from "./humanitec";
|
||||||
|
import {
|
||||||
|
TLaravelForgeSync,
|
||||||
|
TLaravelForgeSyncInput,
|
||||||
|
TLaravelForgeSyncListItem,
|
||||||
|
TLaravelForgeSyncWithCredentials
|
||||||
|
} from "./laravel-forge";
|
||||||
import { TNetlifySync, TNetlifySyncInput, TNetlifySyncListItem, TNetlifySyncWithCredentials } from "./netlify";
|
import { TNetlifySync, TNetlifySyncInput, TNetlifySyncListItem, TNetlifySyncWithCredentials } from "./netlify";
|
||||||
import {
|
import {
|
||||||
TRailwaySync,
|
TRailwaySync,
|
||||||
@@ -164,6 +170,7 @@ export type TSecretSync =
|
|||||||
| TTerraformCloudSync
|
| TTerraformCloudSync
|
||||||
| TCamundaSync
|
| TCamundaSync
|
||||||
| TVercelSync
|
| TVercelSync
|
||||||
|
| TLaravelForgeSync
|
||||||
| TWindmillSync
|
| TWindmillSync
|
||||||
| THCVaultSync
|
| THCVaultSync
|
||||||
| TTeamCitySync
|
| TTeamCitySync
|
||||||
@@ -212,7 +219,8 @@ export type TSecretSyncWithCredentials =
|
|||||||
| TSupabaseSyncWithCredentials
|
| TSupabaseSyncWithCredentials
|
||||||
| TDigitalOceanAppPlatformSyncWithCredentials
|
| TDigitalOceanAppPlatformSyncWithCredentials
|
||||||
| TNetlifySyncWithCredentials
|
| TNetlifySyncWithCredentials
|
||||||
| TBitbucketSyncWithCredentials;
|
| TBitbucketSyncWithCredentials
|
||||||
|
| TLaravelForgeSyncWithCredentials;
|
||||||
|
|
||||||
export type TSecretSyncInput =
|
export type TSecretSyncInput =
|
||||||
| TAwsParameterStoreSyncInput
|
| TAwsParameterStoreSyncInput
|
||||||
@@ -244,7 +252,8 @@ export type TSecretSyncInput =
|
|||||||
| TSupabaseSyncInput
|
| TSupabaseSyncInput
|
||||||
| TDigitalOceanAppPlatformSyncInput
|
| TDigitalOceanAppPlatformSyncInput
|
||||||
| TNetlifySyncInput
|
| TNetlifySyncInput
|
||||||
| TBitbucketSyncInput;
|
| TBitbucketSyncInput
|
||||||
|
| TLaravelForgeSyncInput;
|
||||||
|
|
||||||
export type TSecretSyncListItem =
|
export type TSecretSyncListItem =
|
||||||
| TAwsParameterStoreSyncListItem
|
| TAwsParameterStoreSyncListItem
|
||||||
@@ -259,6 +268,7 @@ export type TSecretSyncListItem =
|
|||||||
| TTerraformCloudSyncListItem
|
| TTerraformCloudSyncListItem
|
||||||
| TCamundaSyncListItem
|
| TCamundaSyncListItem
|
||||||
| TVercelSyncListItem
|
| TVercelSyncListItem
|
||||||
|
| TLaravelForgeSyncListItem
|
||||||
| TWindmillSyncListItem
|
| TWindmillSyncListItem
|
||||||
| THCVaultSyncListItem
|
| THCVaultSyncListItem
|
||||||
| TTeamCitySyncListItem
|
| TTeamCitySyncListItem
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
title: "Available"
|
||||||
|
openapi: "GET /api/v1/app-connections/laravel-forge/available"
|
||||||
|
---
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
title: "Create"
|
||||||
|
openapi: "POST /api/v1/app-connections/laravel-forge"
|
||||||
|
---
|
||||||
|
|
||||||
|
<Note>
|
||||||
|
Check out the configuration docs for [Laravel Forge
|
||||||
|
Connections](/integrations/app-connections/laravel-forge) to learn how to
|
||||||
|
obtain the required credentials.
|
||||||
|
</Note>
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
title: "Delete"
|
||||||
|
openapi: "DELETE /api/v1/app-connections/laravel-forge/{connectionId}"
|
||||||
|
---
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
title: "Get by ID"
|
||||||
|
openapi: "GET /api/v1/app-connections/laravel-forge/{connectionId}"
|
||||||
|
---
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
title: "Get by Name"
|
||||||
|
openapi: "GET /api/v1/app-connections/laravel-forge/connection-name/{connectionName}"
|
||||||
|
---
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
title: "List"
|
||||||
|
openapi: "GET /api/v1/app-connections/laravel-forge"
|
||||||
|
---
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
title: "Update"
|
||||||
|
openapi: "PATCH /api/v1/app-connections/laravel-forge/{connectionId}"
|
||||||
|
---
|
||||||
|
|
||||||
|
<Note>
|
||||||
|
Check out the configuration docs for [Laravel Forge
|
||||||
|
Connections](/integrations/app-connections/laravel-forge) to learn how to
|
||||||
|
obtain the required credentials.
|
||||||
|
</Note>
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
title: "Create"
|
||||||
|
openapi: "POST /api/v1/secret-syncs/laravel-forge"
|
||||||
|
---
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
title: "Delete"
|
||||||
|
openapi: "DELETE /api/v1/secret-syncs/laravel-forge/{syncId}"
|
||||||
|
---
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
title: "Get by ID"
|
||||||
|
openapi: "GET /api/v1/secret-syncs/laravel-forge/{syncId}"
|
||||||
|
---
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
title: "Get by Name"
|
||||||
|
openapi: "GET /api/v1/secret-syncs/laravel-forge/sync-name/{syncName}"
|
||||||
|
---
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
title: "Import Secrets"
|
||||||
|
openapi: "POST /api/v1/secret-syncs/laravel-forge/{syncId}/import-secrets"
|
||||||
|
---
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
title: "List"
|
||||||
|
openapi: "GET /api/v1/secret-syncs/laravel-forge"
|
||||||
|
---
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
title: "Remove Secrets"
|
||||||
|
openapi: "POST /api/v1/secret-syncs/laravel-forge/{syncId}/remove-secrets"
|
||||||
|
---
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
title: "Sync Secrets"
|
||||||
|
openapi: "POST /api/v1/secret-syncs/laravel-forge/{syncId}/sync-secrets"
|
||||||
|
---
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
title: "Update"
|
||||||
|
openapi: "PATCH /api/v1/secret-syncs/laravel-forge/{syncId}"
|
||||||
|
---
|
||||||
@@ -125,6 +125,7 @@
|
|||||||
"integrations/app-connections/hashicorp-vault",
|
"integrations/app-connections/hashicorp-vault",
|
||||||
"integrations/app-connections/heroku",
|
"integrations/app-connections/heroku",
|
||||||
"integrations/app-connections/humanitec",
|
"integrations/app-connections/humanitec",
|
||||||
|
"integrations/app-connections/laravel-forge",
|
||||||
"integrations/app-connections/ldap",
|
"integrations/app-connections/ldap",
|
||||||
"integrations/app-connections/mssql",
|
"integrations/app-connections/mssql",
|
||||||
"integrations/app-connections/mysql",
|
"integrations/app-connections/mysql",
|
||||||
@@ -550,6 +551,7 @@
|
|||||||
"integrations/secret-syncs/hashicorp-vault",
|
"integrations/secret-syncs/hashicorp-vault",
|
||||||
"integrations/secret-syncs/heroku",
|
"integrations/secret-syncs/heroku",
|
||||||
"integrations/secret-syncs/humanitec",
|
"integrations/secret-syncs/humanitec",
|
||||||
|
"integrations/secret-syncs/laravel-forge",
|
||||||
"integrations/secret-syncs/netlify",
|
"integrations/secret-syncs/netlify",
|
||||||
"integrations/secret-syncs/oci-vault",
|
"integrations/secret-syncs/oci-vault",
|
||||||
"integrations/secret-syncs/railway",
|
"integrations/secret-syncs/railway",
|
||||||
@@ -1778,6 +1780,18 @@
|
|||||||
"api-reference/endpoints/app-connections/humanitec/delete"
|
"api-reference/endpoints/app-connections/humanitec/delete"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"group": "Laravel Forge",
|
||||||
|
"pages": [
|
||||||
|
"api-reference/endpoints/app-connections/laravel-forge/list",
|
||||||
|
"api-reference/endpoints/app-connections/laravel-forge/available",
|
||||||
|
"api-reference/endpoints/app-connections/laravel-forge/get-by-id",
|
||||||
|
"api-reference/endpoints/app-connections/laravel-forge/get-by-name",
|
||||||
|
"api-reference/endpoints/app-connections/laravel-forge/create",
|
||||||
|
"api-reference/endpoints/app-connections/laravel-forge/update",
|
||||||
|
"api-reference/endpoints/app-connections/laravel-forge/delete"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"group": "LDAP",
|
"group": "LDAP",
|
||||||
"pages": [
|
"pages": [
|
||||||
@@ -2258,6 +2272,19 @@
|
|||||||
"api-reference/endpoints/secret-syncs/humanitec/remove-secrets"
|
"api-reference/endpoints/secret-syncs/humanitec/remove-secrets"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"group": "Laravel Forge",
|
||||||
|
"pages": [
|
||||||
|
"api-reference/endpoints/secret-syncs/laravel-forge/list",
|
||||||
|
"api-reference/endpoints/secret-syncs/laravel-forge/get-by-id",
|
||||||
|
"api-reference/endpoints/secret-syncs/laravel-forge/get-by-name",
|
||||||
|
"api-reference/endpoints/secret-syncs/laravel-forge/create",
|
||||||
|
"api-reference/endpoints/secret-syncs/laravel-forge/update",
|
||||||
|
"api-reference/endpoints/secret-syncs/laravel-forge/delete",
|
||||||
|
"api-reference/endpoints/secret-syncs/laravel-forge/sync-secrets",
|
||||||
|
"api-reference/endpoints/secret-syncs/laravel-forge/remove-secrets"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"group": "Netlify",
|
"group": "Netlify",
|
||||||
"pages": [
|
"pages": [
|
||||||
|
|||||||
|
After Width: | Height: | Size: 176 KiB |
|
After Width: | Height: | Size: 150 KiB |
|
After Width: | Height: | Size: 137 KiB |
|
After Width: | Height: | Size: 333 KiB |
|
After Width: | Height: | Size: 504 KiB |
|
After Width: | Height: | Size: 296 KiB |
|
After Width: | Height: | Size: 200 KiB |
|
After Width: | Height: | Size: 293 KiB |
|
After Width: | Height: | Size: 527 KiB |
|
After Width: | Height: | Size: 357 KiB |
|
After Width: | Height: | Size: 322 KiB |
|
After Width: | Height: | Size: 373 KiB |
|
After Width: | Height: | Size: 360 KiB |
|
After Width: | Height: | Size: 306 KiB |
@@ -0,0 +1,107 @@
|
|||||||
|
---
|
||||||
|
title: "Laravel Forge Connection"
|
||||||
|
description: "Learn how to configure a Laravel Forge Connection for Infisical."
|
||||||
|
---
|
||||||
|
|
||||||
|
Infisical supports the use of [API Tokens](https://forge.laravel.com/docs/api#create-a-new-api-token) to connect with Laravel Forge.
|
||||||
|
|
||||||
|
## Create Laravel Forge API Token
|
||||||
|
|
||||||
|
<Steps>
|
||||||
|
<Step title="From your Laravel Forge dashboard, click on your user avatar and go to 'API'">
|
||||||
|

|
||||||
|
</Step>
|
||||||
|
<Step title="Click 'Create Token'">
|
||||||
|

|
||||||
|
</Step>
|
||||||
|
<Step title="Provide Token Information">
|
||||||
|
Provide a name for your token and select the following permissions:
|
||||||
|
- `user:view`
|
||||||
|
- `organization:view`
|
||||||
|
- `server:view`
|
||||||
|
- `site:manage-environment`
|
||||||
|
|
||||||
|
Then click 'Add token'.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
</Step>
|
||||||
|
<Step title="Copy the token securely">
|
||||||
|
Make sure to copy the token now—you won’t be able to access it again.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
</Step>
|
||||||
|
</Steps>
|
||||||
|
|
||||||
|
## Create a Laravel Forge Connection in Infisical
|
||||||
|
|
||||||
|
<Tabs>
|
||||||
|
<Tab title="Infisical UI">
|
||||||
|
<Steps>
|
||||||
|
<Step title="Navigate to App Connections">
|
||||||
|
In your Infisical dashboard, navigate to the **App Connections** page in the desired project.
|
||||||
|

|
||||||
|
</Step>
|
||||||
|
<Step title="Select Laravel Forge Connection">
|
||||||
|
Click **+ Add Connection** and choose **Laravel Forge** Connection from the list of integrations.
|
||||||
|

|
||||||
|
</Step>
|
||||||
|
<Step title="Fill out the Laravel Forge Connection form">
|
||||||
|
Complete the form by providing:
|
||||||
|
- A descriptive name for the connection
|
||||||
|
- An optional description
|
||||||
|
- The API Token from the previous step
|
||||||
|

|
||||||
|
</Step>
|
||||||
|
<Step title="Connection created">
|
||||||
|
After submitting the form, your **Laravel Forge Connection** will be successfully created and ready to use with your Infisical project.
|
||||||
|

|
||||||
|
</Step>
|
||||||
|
</Steps>
|
||||||
|
|
||||||
|
</Tab>
|
||||||
|
|
||||||
|
<Tab title="API">
|
||||||
|
To create a Laravel Forge Connection via API, send a request to the [Create Laravel Forge Connection](/api-reference/endpoints/app-connections/laravel-forge/create) endpoint.
|
||||||
|
|
||||||
|
### Sample request
|
||||||
|
|
||||||
|
```bash Request
|
||||||
|
curl --request POST \
|
||||||
|
--url https://app.infisical.com/api/v1/app-connections/laravel-forge \
|
||||||
|
--header 'Content-Type: application/json' \
|
||||||
|
--data '{
|
||||||
|
"name": "my-laravel-forge-connection",
|
||||||
|
"method": "api-token",
|
||||||
|
"projectId": "7ffbb072-2575-495a-b5b0-127f88caef78",
|
||||||
|
"credentials": {
|
||||||
|
"apiToken": "[API TOKEN]"
|
||||||
|
}
|
||||||
|
}'
|
||||||
|
```
|
||||||
|
|
||||||
|
### Sample response
|
||||||
|
|
||||||
|
```bash Response
|
||||||
|
{
|
||||||
|
"appConnection": {
|
||||||
|
"id": "a1b2c3d4-5678-90ab-cdef-1234567890ab",
|
||||||
|
"name": "my-laravel-forge-connection",
|
||||||
|
"description": null,
|
||||||
|
"projectId": "7ffbb072-2575-495a-b5b0-127f88caef78",
|
||||||
|
"version": 1,
|
||||||
|
"orgId": "abcdef12-3456-7890-abcd-ef1234567890",
|
||||||
|
"createdAt": "2025-10-13T10:15:00.000Z",
|
||||||
|
"updatedAt": "2025-10-13T10:15:00.000Z",
|
||||||
|
"isPlatformManagedCredentials": false,
|
||||||
|
"credentialsHash": "d41d8cd98f00b204e9800998ecf8427e",
|
||||||
|
"app": "laravel-forge",
|
||||||
|
"method": "api-token",
|
||||||
|
"credentials": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
</Tab>
|
||||||
|
</Tabs>
|
||||||
@@ -0,0 +1,157 @@
|
|||||||
|
---
|
||||||
|
title: "Laravel Forge Sync"
|
||||||
|
description: "Learn how to configure a Laravel Forge Sync for Infisical."
|
||||||
|
---
|
||||||
|
|
||||||
|
**Prerequisites:**
|
||||||
|
|
||||||
|
- Create a [Laravel Forge Connection](/integrations/app-connections/laravel-forge)
|
||||||
|
|
||||||
|
<Tabs>
|
||||||
|
<Tab title="Infisical UI">
|
||||||
|
<Steps>
|
||||||
|
<Step title="Add Sync">
|
||||||
|
Navigate to **Project** > **Integrations** and select the **Secret Syncs** tab. Click on the **Add Sync** button.
|
||||||
|
|
||||||
|

|
||||||
|
</Step>
|
||||||
|
<Step title="Select 'Laravel Forge'">
|
||||||
|

|
||||||
|
</Step>
|
||||||
|
<Step title="Configure source">
|
||||||
|
Configure the **Source** from where secrets should be retrieved, then click **Next**.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
- **Environment**: The project environment to retrieve secrets from.
|
||||||
|
- **Secret Path**: The folder path to retrieve secrets from.
|
||||||
|
|
||||||
|
<Tip>
|
||||||
|
If you need to sync secrets from multiple folder locations, check out [secret imports](/documentation/platform/secret-reference#secret-imports).
|
||||||
|
</Tip>
|
||||||
|
</Step>
|
||||||
|
<Step title="Configure destination">
|
||||||
|
Configure the **Destination** to where secrets should be deployed, then click **Next**.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
- **Laravel Forge Connection**: The Laravel Forge Connection to authenticate with.
|
||||||
|
- **Organization**: The Organization in which the server and site reside.
|
||||||
|
- **Server**: The Server on which the site resides.
|
||||||
|
- **Site**: The Site for which secrets should be synced.
|
||||||
|
</Step>
|
||||||
|
<Step title="Configure Sync Options">
|
||||||
|
Configure the **Sync Options** to specify how secrets should be synced, then click **Next**.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
- **Initial Sync Behavior**: Determines how Infisical should resolve the initial sync.
|
||||||
|
- **Overwrite Destination Secrets**: Removes any secrets at the destination endpoint not present in Infisical.
|
||||||
|
- **Import Secrets (Prioritize Infisical)**: Imports secrets from the destination endpoint before syncing, prioritizing values from Infisical over Laravel Forge when keys conflict.
|
||||||
|
- **Import Secrets (Prioritize Laravel Forge)**: Imports secrets from the destination endpoint before syncing, prioritizing values from Laravel Forge over Infisical when keys conflict.
|
||||||
|
- **Key Schema**: Template that determines how secret names are transformed when syncing, using `{{secretKey}}` as a placeholder for the original secret name and `{{environment}}` for the environment.
|
||||||
|
<Note>
|
||||||
|
We highly recommend using a Key Schema to ensure that Infisical only manages the specific keys you intend, keeping everything else untouched.
|
||||||
|
</Note>
|
||||||
|
- **Auto-Sync Enabled**: If enabled, secrets will automatically be synced from the source location when changes occur. Disable to enforce manual syncing only.
|
||||||
|
- **Disable Secret Deletion**: If enabled, Infisical will not remove secrets from the sync destination. Enable this option if you intend to manage some secrets manually outside of Infisical.
|
||||||
|
</Step>
|
||||||
|
<Step title="Configure details">
|
||||||
|
Configure the **Details** of your Laravel Forge Sync, then click **Next**.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
- **Name**: The name of your sync. Must be slug-friendly.
|
||||||
|
- **Description**: An optional description for your sync.
|
||||||
|
</Step>
|
||||||
|
<Step title="Review configuration">
|
||||||
|
Review your Laravel Forge Sync configuration, then click **Create Sync**.
|
||||||
|
|
||||||
|

|
||||||
|
</Step>
|
||||||
|
<Step title="Sync created">
|
||||||
|
If enabled, your Laravel Forge Sync will begin syncing your secrets to the destination endpoint.
|
||||||
|
|
||||||
|

|
||||||
|
</Step>
|
||||||
|
</Steps>
|
||||||
|
|
||||||
|
</Tab>
|
||||||
|
|
||||||
|
<Tab title="API">
|
||||||
|
To create a **Laravel Forge Sync**, make an API request to the [Create Laravel Forge Sync](/api-reference/endpoints/secret-syncs/laravel-forge/create) API endpoint.
|
||||||
|
|
||||||
|
### Sample request
|
||||||
|
|
||||||
|
```bash Request
|
||||||
|
curl --request POST \
|
||||||
|
--url https://app.infisical.com/api/v1/secret-syncs/laravel-forge \
|
||||||
|
--header 'Content-Type: application/json' \
|
||||||
|
--data '{
|
||||||
|
"name": "my-laravel-forge-sync",
|
||||||
|
"projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
|
||||||
|
"description": "sync to laravel forge site",
|
||||||
|
"connectionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
|
||||||
|
"environment": "dev",
|
||||||
|
"secretPath": "/",
|
||||||
|
"isEnabled": true,
|
||||||
|
"isAutoSyncEnabled": true,
|
||||||
|
"syncOptions": {
|
||||||
|
"initialSyncBehavior": "overwrite-destination",
|
||||||
|
"disableSecretDeletion": false
|
||||||
|
},
|
||||||
|
"destinationConfig": {
|
||||||
|
"orgSlug": "org-abc123",
|
||||||
|
"serverId": "123",
|
||||||
|
"siteId": "site-abc123"
|
||||||
|
}
|
||||||
|
}'
|
||||||
|
```
|
||||||
|
|
||||||
|
### Sample response
|
||||||
|
|
||||||
|
```bash Response
|
||||||
|
{
|
||||||
|
"secretSync": {
|
||||||
|
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
|
||||||
|
"name": "my-laravel-forge-sync",
|
||||||
|
"description": "sync to laravel forge site",
|
||||||
|
"folderId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
|
||||||
|
"connectionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
|
||||||
|
"createdAt": "2025-07-19T12:00:00Z",
|
||||||
|
"updatedAt": "2025-07-19T12:00:00Z",
|
||||||
|
"syncStatus": "succeeded",
|
||||||
|
"lastSyncJobId": "job-1234",
|
||||||
|
"lastSyncMessage": null,
|
||||||
|
"lastSyncedAt": "2025-07-19T12:00:00Z",
|
||||||
|
"syncOptions": {
|
||||||
|
"initialSyncBehavior": "overwrite-destination",
|
||||||
|
"disableSecretDeletion": false
|
||||||
|
},
|
||||||
|
"projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
|
||||||
|
"connection": {
|
||||||
|
"app": "laravel-forge",
|
||||||
|
"name": "my-laravel-forge-connection",
|
||||||
|
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
|
||||||
|
},
|
||||||
|
"environment": {
|
||||||
|
"slug": "dev",
|
||||||
|
"name": "Development",
|
||||||
|
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
|
||||||
|
},
|
||||||
|
"folder": {
|
||||||
|
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
|
||||||
|
"path": "/"
|
||||||
|
},
|
||||||
|
"destination": "laravel-forge",
|
||||||
|
"destinationConfig": {
|
||||||
|
"orgSlug": "org-abc123",
|
||||||
|
"serverId": "123",
|
||||||
|
"siteId": "site-abc123"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
</Tab>
|
||||||
|
</Tabs>
|
||||||
@@ -78,6 +78,7 @@ description: "Learn how to configure a Netlify Sync for Infisical."
|
|||||||

|

|
||||||
</Step>
|
</Step>
|
||||||
</Steps>
|
</Steps>
|
||||||
|
|
||||||
</Tab>
|
</Tab>
|
||||||
|
|
||||||
<Tab title="API">
|
<Tab title="API">
|
||||||
@@ -157,5 +158,6 @@ description: "Learn how to configure a Netlify Sync for Infisical."
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
</Tab>
|
</Tab>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
|
|||||||
@@ -45,7 +45,8 @@ export const AppConnectionsBrowser = () => {
|
|||||||
{"name": "Redis", "slug": "redis", "path": "/integrations/app-connections/redis", "description": "Learn how to connect Redis to pull secrets from Infisical.", "category": "Databases"},
|
{"name": "Redis", "slug": "redis", "path": "/integrations/app-connections/redis", "description": "Learn how to connect Redis to pull secrets from Infisical.", "category": "Databases"},
|
||||||
{"name": "LDAP", "slug": "ldap", "path": "/integrations/app-connections/ldap", "description": "Learn how to connect your LDAP to pull secrets from Infisical.", "category": "Directory Services"},
|
{"name": "LDAP", "slug": "ldap", "path": "/integrations/app-connections/ldap", "description": "Learn how to connect your LDAP to pull secrets from Infisical.", "category": "Directory Services"},
|
||||||
{"name": "Auth0", "slug": "auth0", "path": "/integrations/app-connections/auth0", "description": "Learn how to connect your Auth0 to pull secrets from Infisical.", "category": "Identity & Auth"},
|
{"name": "Auth0", "slug": "auth0", "path": "/integrations/app-connections/auth0", "description": "Learn how to connect your Auth0 to pull secrets from Infisical.", "category": "Identity & Auth"},
|
||||||
{"name": "Okta", "slug": "okta", "path": "/integrations/app-connections/okta", "description": "Learn how to connect your Okta to pull secrets from Infisical.", "category": "Identity & Auth"}
|
{"name": "Okta", "slug": "okta", "path": "/integrations/app-connections/okta", "description": "Learn how to connect your Okta to pull secrets from Infisical.", "category": "Identity & Auth"},
|
||||||
|
{"name": "Laravel Forge", "slug": "laravel-forge", "path": "/integrations/app-connections/laravel-forge", "description": "Learn how to connect your Laravel Forge to pull secrets from Infisical.", "category": "Hosting"},
|
||||||
].sort(function(a, b) {
|
].sort(function(a, b) {
|
||||||
return a.name.toLowerCase().localeCompare(b.name.toLowerCase());
|
return a.name.toLowerCase().localeCompare(b.name.toLowerCase());
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -36,7 +36,8 @@ export const SecretSyncsBrowser = () => {
|
|||||||
{"name": "Camunda", "slug": "camunda", "path": "/integrations/secret-syncs/camunda", "description": "Learn how to sync secrets from Infisical to Camunda.", "category": "DevOps Tools"},
|
{"name": "Camunda", "slug": "camunda", "path": "/integrations/secret-syncs/camunda", "description": "Learn how to sync secrets from Infisical to Camunda.", "category": "DevOps Tools"},
|
||||||
{"name": "Humanitec", "slug": "humanitec", "path": "/integrations/secret-syncs/humanitec", "description": "Learn how to sync secrets from Infisical to Humanitec.", "category": "DevOps Tools"},
|
{"name": "Humanitec", "slug": "humanitec", "path": "/integrations/secret-syncs/humanitec", "description": "Learn how to sync secrets from Infisical to Humanitec.", "category": "DevOps Tools"},
|
||||||
{"name": "OCI Vault", "slug": "oci-vault", "path": "/integrations/secret-syncs/oci-vault", "description": "Learn how to sync secrets from Infisical to OCI Vault.", "category": "Cloud Providers"},
|
{"name": "OCI Vault", "slug": "oci-vault", "path": "/integrations/secret-syncs/oci-vault", "description": "Learn how to sync secrets from Infisical to OCI Vault.", "category": "Cloud Providers"},
|
||||||
{"name": "Zabbix", "slug": "zabbix", "path": "/integrations/secret-syncs/zabbix", "description": "Learn how to sync secrets from Infisical to Zabbix.", "category": "Monitoring"}
|
{"name": "Zabbix", "slug": "zabbix", "path": "/integrations/secret-syncs/zabbix", "description": "Learn how to sync secrets from Infisical to Zabbix.", "category": "Monitoring"},
|
||||||
|
{"name": "Laravel Forge", "slug": "laravel-forge", "path": "/integrations/secret-syncs/laravel-forge", "description": "Learn how to sync secrets from Infisical to Laravel Forge.", "category": "Hosting"}
|
||||||
].sort(function(a, b) {
|
].sort(function(a, b) {
|
||||||
return a.name.toLowerCase().localeCompare(b.name.toLowerCase());
|
return a.name.toLowerCase().localeCompare(b.name.toLowerCase());
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ export const SecretSyncModalHeader = ({ destination, isConfigured }: Props) => {
|
|||||||
<img
|
<img
|
||||||
alt={`${destinationDetails.name} logo`}
|
alt={`${destinationDetails.name} logo`}
|
||||||
src={`/images/integrations/${destinationDetails.image}`}
|
src={`/images/integrations/${destinationDetails.image}`}
|
||||||
className="h-12 w-12 rounded-md bg-bunker-500 p-2"
|
className="h-12 w-12 rounded-md bg-bunker-500 object-contain p-2"
|
||||||
/>
|
/>
|
||||||
<div>
|
<div>
|
||||||
<div className="flex items-center text-mineshaft-300">
|
<div className="flex items-center text-mineshaft-300">
|
||||||
|
|||||||
@@ -0,0 +1,138 @@
|
|||||||
|
import { Controller, useFormContext, useWatch } from "react-hook-form";
|
||||||
|
import { SingleValue } from "react-select";
|
||||||
|
|
||||||
|
import { SecretSyncConnectionField } from "@app/components/secret-syncs/forms/SecretSyncConnectionField";
|
||||||
|
import { FilterableSelect, FormControl } from "@app/components/v2";
|
||||||
|
import {
|
||||||
|
TLaravelForgeOrganization,
|
||||||
|
TLaravelForgeServer,
|
||||||
|
TLaravelForgeSite,
|
||||||
|
useLaravelForgeConnectionListOrganizations,
|
||||||
|
useLaravelForgeConnectionListServers,
|
||||||
|
useLaravelForgeConnectionListSites
|
||||||
|
} from "@app/hooks/api/appConnections/laravel-forge";
|
||||||
|
import { SecretSync } from "@app/hooks/api/secretSyncs";
|
||||||
|
|
||||||
|
import { TSecretSyncForm } from "../schemas";
|
||||||
|
|
||||||
|
export const LaravelForgeSyncFields = () => {
|
||||||
|
const { control, setValue } = useFormContext<
|
||||||
|
TSecretSyncForm & { destination: SecretSync.LaravelForge }
|
||||||
|
>();
|
||||||
|
|
||||||
|
const connectionId = useWatch({ name: "connection.id", control });
|
||||||
|
const orgSlug = useWatch({ name: "destinationConfig.orgSlug", control });
|
||||||
|
const serverId = useWatch({ name: "destinationConfig.serverId", control });
|
||||||
|
|
||||||
|
const { data: organizations, isLoading: isOrganizationsLoading } =
|
||||||
|
useLaravelForgeConnectionListOrganizations(connectionId, {
|
||||||
|
enabled: Boolean(connectionId)
|
||||||
|
});
|
||||||
|
|
||||||
|
const { data: servers, isLoading: isServersLoading } = useLaravelForgeConnectionListServers(
|
||||||
|
connectionId,
|
||||||
|
orgSlug,
|
||||||
|
{
|
||||||
|
enabled: Boolean(connectionId && orgSlug)
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
const { data: sites, isLoading: isSitesLoading } = useLaravelForgeConnectionListSites(
|
||||||
|
connectionId,
|
||||||
|
orgSlug,
|
||||||
|
serverId,
|
||||||
|
{
|
||||||
|
enabled: Boolean(connectionId && orgSlug && serverId)
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
const handleChangeConnection = () => {
|
||||||
|
setValue("destinationConfig.orgSlug", "");
|
||||||
|
setValue("destinationConfig.serverId", "");
|
||||||
|
setValue("destinationConfig.siteId", "");
|
||||||
|
setValue("destinationConfig.orgName", "");
|
||||||
|
setValue("destinationConfig.serverName", "");
|
||||||
|
setValue("destinationConfig.siteName", "");
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<SecretSyncConnectionField onChange={handleChangeConnection} />
|
||||||
|
|
||||||
|
<Controller
|
||||||
|
name="destinationConfig.orgSlug"
|
||||||
|
control={control}
|
||||||
|
render={({ field: { value, onChange }, fieldState: { error } }) => (
|
||||||
|
<FormControl isError={Boolean(error)} errorText={error?.message} label="Organization">
|
||||||
|
<FilterableSelect
|
||||||
|
menuPlacement="top"
|
||||||
|
isLoading={isOrganizationsLoading && Boolean(connectionId)}
|
||||||
|
isDisabled={!connectionId}
|
||||||
|
value={organizations?.find((org) => org.slug === value) ?? null}
|
||||||
|
onChange={(option) => {
|
||||||
|
const selectedOrg = option as SingleValue<TLaravelForgeOrganization>;
|
||||||
|
onChange(selectedOrg?.slug ?? "");
|
||||||
|
setValue("destinationConfig.orgName", selectedOrg?.name ?? "");
|
||||||
|
setValue("destinationConfig.serverId", "");
|
||||||
|
setValue("destinationConfig.siteId", "");
|
||||||
|
}}
|
||||||
|
options={organizations}
|
||||||
|
placeholder="Select an organization..."
|
||||||
|
getOptionLabel={(option) => option.name}
|
||||||
|
getOptionValue={(option) => option.id}
|
||||||
|
/>
|
||||||
|
</FormControl>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Controller
|
||||||
|
name="destinationConfig.serverId"
|
||||||
|
control={control}
|
||||||
|
render={({ field: { value, onChange }, fieldState: { error } }) => (
|
||||||
|
<FormControl isError={Boolean(error)} errorText={error?.message} label="Server">
|
||||||
|
<FilterableSelect
|
||||||
|
menuPlacement="top"
|
||||||
|
isLoading={isServersLoading && Boolean(connectionId && orgSlug)}
|
||||||
|
isDisabled={!connectionId || !orgSlug}
|
||||||
|
value={servers?.find((server) => server.id === value) ?? null}
|
||||||
|
onChange={(option) => {
|
||||||
|
const selectedServer = option as SingleValue<TLaravelForgeServer>;
|
||||||
|
onChange(selectedServer?.id ?? "");
|
||||||
|
setValue("destinationConfig.serverName", selectedServer?.name ?? "");
|
||||||
|
setValue("destinationConfig.siteId", "");
|
||||||
|
}}
|
||||||
|
options={servers}
|
||||||
|
placeholder="Select a server..."
|
||||||
|
getOptionLabel={(option) => option.name}
|
||||||
|
getOptionValue={(option) => option.id}
|
||||||
|
/>
|
||||||
|
</FormControl>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Controller
|
||||||
|
name="destinationConfig.siteId"
|
||||||
|
control={control}
|
||||||
|
render={({ field: { value, onChange }, fieldState: { error } }) => (
|
||||||
|
<FormControl isError={Boolean(error)} errorText={error?.message} label="Site">
|
||||||
|
<FilterableSelect
|
||||||
|
menuPlacement="top"
|
||||||
|
isLoading={isSitesLoading && Boolean(connectionId && orgSlug && serverId)}
|
||||||
|
isDisabled={!connectionId || !orgSlug || !serverId}
|
||||||
|
value={sites?.find((site) => site.id === value) ?? null}
|
||||||
|
onChange={(option) => {
|
||||||
|
const selectedSite = option as SingleValue<TLaravelForgeSite>;
|
||||||
|
onChange(selectedSite?.id ?? "");
|
||||||
|
setValue("destinationConfig.siteName", selectedSite?.name ?? "");
|
||||||
|
}}
|
||||||
|
options={sites}
|
||||||
|
placeholder="Select a site..."
|
||||||
|
getOptionLabel={(option) => option.name}
|
||||||
|
getOptionValue={(option) => option.id}
|
||||||
|
/>
|
||||||
|
</FormControl>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -23,6 +23,7 @@ import { GitLabSyncFields } from "./GitLabSyncFields";
|
|||||||
import { HCVaultSyncFields } from "./HCVaultSyncFields";
|
import { HCVaultSyncFields } from "./HCVaultSyncFields";
|
||||||
import { HerokuSyncFields } from "./HerokuSyncFields";
|
import { HerokuSyncFields } from "./HerokuSyncFields";
|
||||||
import { HumanitecSyncFields } from "./HumanitecSyncFields";
|
import { HumanitecSyncFields } from "./HumanitecSyncFields";
|
||||||
|
import { LaravelForgeSyncFields } from "./LaravelForgeSyncFields";
|
||||||
import { NetlifySyncFields } from "./NetlifySyncFields";
|
import { NetlifySyncFields } from "./NetlifySyncFields";
|
||||||
import { OCIVaultSyncFields } from "./OCIVaultSyncFields";
|
import { OCIVaultSyncFields } from "./OCIVaultSyncFields";
|
||||||
import { RailwaySyncFields } from "./RailwaySyncFields";
|
import { RailwaySyncFields } from "./RailwaySyncFields";
|
||||||
@@ -100,6 +101,8 @@ export const SecretSyncDestinationFields = () => {
|
|||||||
return <NetlifySyncFields />;
|
return <NetlifySyncFields />;
|
||||||
case SecretSync.Bitbucket:
|
case SecretSync.Bitbucket:
|
||||||
return <BitbucketSyncFields />;
|
return <BitbucketSyncFields />;
|
||||||
|
case SecretSync.LaravelForge:
|
||||||
|
return <LaravelForgeSyncFields />;
|
||||||
default:
|
default:
|
||||||
throw new Error(`Unhandled Destination Config Field: ${destination}`);
|
throw new Error(`Unhandled Destination Config Field: ${destination}`);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ export const SecretSyncOptionsFields = ({ hideInitialSync }: Props) => {
|
|||||||
case SecretSync.DigitalOceanAppPlatform:
|
case SecretSync.DigitalOceanAppPlatform:
|
||||||
case SecretSync.Netlify:
|
case SecretSync.Netlify:
|
||||||
case SecretSync.Bitbucket:
|
case SecretSync.Bitbucket:
|
||||||
|
case SecretSync.LaravelForge:
|
||||||
AdditionalSyncOptionsFieldsComponent = null;
|
AdditionalSyncOptionsFieldsComponent = null;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
import { useFormContext } from "react-hook-form";
|
||||||
|
|
||||||
|
import { TSecretSyncForm } from "@app/components/secret-syncs/forms/schemas";
|
||||||
|
import { GenericFieldLabel } from "@app/components/v2";
|
||||||
|
import { SecretSync } from "@app/hooks/api/secretSyncs";
|
||||||
|
|
||||||
|
export const LaravelForgeSyncReviewFields = () => {
|
||||||
|
const { watch } = useFormContext<TSecretSyncForm & { destination: SecretSync.LaravelForge }>();
|
||||||
|
const orgName = watch("destinationConfig.orgName");
|
||||||
|
const orgSlug = watch("destinationConfig.orgSlug");
|
||||||
|
const serverName = watch("destinationConfig.serverName");
|
||||||
|
const serverId = watch("destinationConfig.serverId");
|
||||||
|
const siteName = watch("destinationConfig.siteName");
|
||||||
|
const siteId = watch("destinationConfig.siteId");
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<GenericFieldLabel label="Account">{orgName || orgSlug}</GenericFieldLabel>
|
||||||
|
<GenericFieldLabel label="Server">{serverName || serverId || "None"}</GenericFieldLabel>
|
||||||
|
<GenericFieldLabel label="Site">{siteName || siteId || "None"}</GenericFieldLabel>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -35,6 +35,7 @@ import { GitLabSyncReviewFields } from "./GitLabSyncReviewFields";
|
|||||||
import { HCVaultSyncReviewFields } from "./HCVaultSyncReviewFields";
|
import { HCVaultSyncReviewFields } from "./HCVaultSyncReviewFields";
|
||||||
import { HerokuSyncReviewFields } from "./HerokuSyncReviewFields";
|
import { HerokuSyncReviewFields } from "./HerokuSyncReviewFields";
|
||||||
import { HumanitecSyncReviewFields } from "./HumanitecSyncReviewFields";
|
import { HumanitecSyncReviewFields } from "./HumanitecSyncReviewFields";
|
||||||
|
import { LaravelForgeSyncReviewFields } from "./LaravelForgeSyncReviewFields";
|
||||||
import { NetlifySyncReviewFields } from "./NetlifySyncReviewFields";
|
import { NetlifySyncReviewFields } from "./NetlifySyncReviewFields";
|
||||||
import { OCIVaultSyncReviewFields } from "./OCIVaultSyncReviewFields";
|
import { OCIVaultSyncReviewFields } from "./OCIVaultSyncReviewFields";
|
||||||
import { OnePassSyncReviewFields } from "./OnePassSyncReviewFields";
|
import { OnePassSyncReviewFields } from "./OnePassSyncReviewFields";
|
||||||
@@ -168,6 +169,9 @@ export const SecretSyncReviewFields = () => {
|
|||||||
case SecretSync.Bitbucket:
|
case SecretSync.Bitbucket:
|
||||||
DestinationFieldsComponent = <BitbucketSyncReviewFields />;
|
DestinationFieldsComponent = <BitbucketSyncReviewFields />;
|
||||||
break;
|
break;
|
||||||
|
case SecretSync.LaravelForge:
|
||||||
|
DestinationFieldsComponent = <LaravelForgeSyncReviewFields />;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
throw new Error(`Unhandled Destination Review Fields: ${destination}`);
|
throw new Error(`Unhandled Destination Review Fields: ${destination}`);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
import { z } from "zod";
|
||||||
|
|
||||||
|
import { BaseSecretSyncSchema } from "@app/components/secret-syncs/forms/schemas/base-secret-sync-schema";
|
||||||
|
import { SecretSync } from "@app/hooks/api/secretSyncs";
|
||||||
|
|
||||||
|
export const LaravelForgeSyncDestinationSchema = BaseSecretSyncSchema().merge(
|
||||||
|
z.object({
|
||||||
|
destination: z.literal(SecretSync.LaravelForge),
|
||||||
|
destinationConfig: z.object({
|
||||||
|
orgSlug: z.string().trim().min(1, "Org Slug required"),
|
||||||
|
orgName: z.string().trim().min(1, "Org Name required"),
|
||||||
|
serverId: z.string().trim().min(1, "Server ID required"),
|
||||||
|
serverName: z.string().trim().min(1, "Server Name required"),
|
||||||
|
siteId: z.string().trim().min(1, "Site ID required"),
|
||||||
|
siteName: z.string().trim().min(1, "Site Name required")
|
||||||
|
})
|
||||||
|
})
|
||||||
|
);
|
||||||
@@ -20,6 +20,7 @@ import { GitlabSyncDestinationSchema } from "./gitlab-sync-destination-schema";
|
|||||||
import { HCVaultSyncDestinationSchema } from "./hc-vault-sync-destination-schema";
|
import { HCVaultSyncDestinationSchema } from "./hc-vault-sync-destination-schema";
|
||||||
import { HerokuSyncDestinationSchema } from "./heroku-sync-destination-schema";
|
import { HerokuSyncDestinationSchema } from "./heroku-sync-destination-schema";
|
||||||
import { HumanitecSyncDestinationSchema } from "./humanitec-sync-destination-schema";
|
import { HumanitecSyncDestinationSchema } from "./humanitec-sync-destination-schema";
|
||||||
|
import { LaravelForgeSyncDestinationSchema } from "./laravel-forge-sync-destination-schema";
|
||||||
import { NetlifySyncDestinationSchema } from "./netlify-sync-destination-schema";
|
import { NetlifySyncDestinationSchema } from "./netlify-sync-destination-schema";
|
||||||
import { OCIVaultSyncDestinationSchema } from "./oci-vault-sync-destination-schema";
|
import { OCIVaultSyncDestinationSchema } from "./oci-vault-sync-destination-schema";
|
||||||
import { RailwaySyncDestinationSchema } from "./railway-sync-destination-schema";
|
import { RailwaySyncDestinationSchema } from "./railway-sync-destination-schema";
|
||||||
@@ -61,7 +62,8 @@ const SecretSyncUnionSchema = z.discriminatedUnion("destination", [
|
|||||||
ChecklySyncDestinationSchema,
|
ChecklySyncDestinationSchema,
|
||||||
DigitalOceanAppPlatformSyncDestinationSchema,
|
DigitalOceanAppPlatformSyncDestinationSchema,
|
||||||
NetlifySyncDestinationSchema,
|
NetlifySyncDestinationSchema,
|
||||||
BitbucketSyncDestinationSchema
|
BitbucketSyncDestinationSchema,
|
||||||
|
LaravelForgeSyncDestinationSchema
|
||||||
]);
|
]);
|
||||||
|
|
||||||
export const SecretSyncFormSchema = SecretSyncUnionSchema;
|
export const SecretSyncFormSchema = SecretSyncUnionSchema;
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ import { BitbucketConnectionMethod } from "@app/hooks/api/appConnections/types/b
|
|||||||
import { ChecklyConnectionMethod } from "@app/hooks/api/appConnections/types/checkly-connection";
|
import { ChecklyConnectionMethod } from "@app/hooks/api/appConnections/types/checkly-connection";
|
||||||
import { DigitalOceanConnectionMethod } from "@app/hooks/api/appConnections/types/digital-ocean";
|
import { DigitalOceanConnectionMethod } from "@app/hooks/api/appConnections/types/digital-ocean";
|
||||||
import { HerokuConnectionMethod } from "@app/hooks/api/appConnections/types/heroku-connection";
|
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 { NetlifyConnectionMethod } from "@app/hooks/api/appConnections/types/netlify-connection";
|
||||||
import { OCIConnectionMethod } from "@app/hooks/api/appConnections/types/oci-connection";
|
import { OCIConnectionMethod } from "@app/hooks/api/appConnections/types/oci-connection";
|
||||||
import { RailwayConnectionMethod } from "@app/hooks/api/appConnections/types/railway-connection";
|
import { RailwayConnectionMethod } from "@app/hooks/api/appConnections/types/railway-connection";
|
||||||
@@ -56,7 +57,13 @@ import { SupabaseConnectionMethod } from "@app/hooks/api/appConnections/types/su
|
|||||||
|
|
||||||
export const APP_CONNECTION_MAP: Record<
|
export const APP_CONNECTION_MAP: Record<
|
||||||
AppConnection,
|
AppConnection,
|
||||||
{ name: string; image: string; size?: number; icon?: IconDefinition; enterprise?: boolean }
|
{
|
||||||
|
name: string;
|
||||||
|
image: string;
|
||||||
|
size?: number;
|
||||||
|
icon?: IconDefinition;
|
||||||
|
enterprise?: boolean;
|
||||||
|
}
|
||||||
> = {
|
> = {
|
||||||
[AppConnection.AWS]: { name: "AWS", image: "Amazon Web Services.png" },
|
[AppConnection.AWS]: { name: "AWS", image: "Amazon Web Services.png" },
|
||||||
[AppConnection.GitHub]: { name: "GitHub", image: "GitHub.png" },
|
[AppConnection.GitHub]: { name: "GitHub", image: "GitHub.png" },
|
||||||
@@ -115,7 +122,12 @@ export const APP_CONNECTION_MAP: Record<
|
|||||||
image: "Netlify.png"
|
image: "Netlify.png"
|
||||||
},
|
},
|
||||||
[AppConnection.Okta]: { name: "Okta", image: "Okta.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",
|
||||||
|
size: 65
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getAppConnectionMethodDetails = (method: TAppConnection["method"]) => {
|
export const getAppConnectionMethodDetails = (method: TAppConnection["method"]) => {
|
||||||
@@ -151,6 +163,7 @@ export const getAppConnectionMethodDetails = (method: TAppConnection["method"])
|
|||||||
case ZabbixConnectionMethod.ApiToken:
|
case ZabbixConnectionMethod.ApiToken:
|
||||||
case DigitalOceanConnectionMethod.ApiToken:
|
case DigitalOceanConnectionMethod.ApiToken:
|
||||||
case OktaConnectionMethod.ApiToken:
|
case OktaConnectionMethod.ApiToken:
|
||||||
|
case LaravelForgeConnectionMethod.ApiToken:
|
||||||
return { name: "API Token", icon: faKey };
|
return { name: "API Token", icon: faKey };
|
||||||
case PostgresConnectionMethod.UsernameAndPassword:
|
case PostgresConnectionMethod.UsernameAndPassword:
|
||||||
case MsSqlConnectionMethod.UsernameAndPassword:
|
case MsSqlConnectionMethod.UsernameAndPassword:
|
||||||
|
|||||||
@@ -113,6 +113,10 @@ export const SECRET_SYNC_MAP: Record<SecretSync, { name: string; image: string }
|
|||||||
[SecretSync.Bitbucket]: {
|
[SecretSync.Bitbucket]: {
|
||||||
name: "Bitbucket",
|
name: "Bitbucket",
|
||||||
image: "Bitbucket.png"
|
image: "Bitbucket.png"
|
||||||
|
},
|
||||||
|
[SecretSync.LaravelForge]: {
|
||||||
|
name: "Laravel Forge",
|
||||||
|
image: "Laravel Forge.png"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -146,7 +150,8 @@ export const SECRET_SYNC_CONNECTION_MAP: Record<SecretSync, AppConnection> = {
|
|||||||
[SecretSync.Checkly]: AppConnection.Checkly,
|
[SecretSync.Checkly]: AppConnection.Checkly,
|
||||||
[SecretSync.DigitalOceanAppPlatform]: AppConnection.DigitalOcean,
|
[SecretSync.DigitalOceanAppPlatform]: AppConnection.DigitalOcean,
|
||||||
[SecretSync.Netlify]: AppConnection.Netlify,
|
[SecretSync.Netlify]: AppConnection.Netlify,
|
||||||
[SecretSync.Bitbucket]: AppConnection.Bitbucket
|
[SecretSync.Bitbucket]: AppConnection.Bitbucket,
|
||||||
|
[SecretSync.LaravelForge]: AppConnection.LaravelForge
|
||||||
};
|
};
|
||||||
|
|
||||||
export const SECRET_SYNC_INITIAL_SYNC_BEHAVIOR_MAP: Record<
|
export const SECRET_SYNC_INITIAL_SYNC_BEHAVIOR_MAP: Record<
|
||||||
|
|||||||
@@ -37,5 +37,6 @@ export enum AppConnection {
|
|||||||
DigitalOcean = "digital-ocean",
|
DigitalOcean = "digital-ocean",
|
||||||
Netlify = "netlify",
|
Netlify = "netlify",
|
||||||
Okta = "okta",
|
Okta = "okta",
|
||||||
Redis = "redis"
|
Redis = "redis",
|
||||||
|
LaravelForge = "laravel-forge"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
export * from "./queries";
|
||||||
|
export * from "./types";
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
import { useQuery, UseQueryOptions } from "@tanstack/react-query";
|
||||||
|
|
||||||
|
import { apiRequest } from "@app/config/request";
|
||||||
|
import { appConnectionKeys } from "@app/hooks/api/appConnections";
|
||||||
|
|
||||||
|
import { TLaravelForgeOrganization, TLaravelForgeServer, TLaravelForgeSite } from "./types";
|
||||||
|
|
||||||
|
const laravelForgeConnectionKeys = {
|
||||||
|
all: [...appConnectionKeys.all, "laravel-forge"] as const,
|
||||||
|
listOrganizations: (connectionId: string) =>
|
||||||
|
[...laravelForgeConnectionKeys.all, "organizations", connectionId] as const,
|
||||||
|
listServers: (connectionId: string, organizationSlug: string) =>
|
||||||
|
[...laravelForgeConnectionKeys.all, "servers", connectionId, organizationSlug] as const,
|
||||||
|
listSites: (connectionId: string, organizationSlug: string, serverId: string) =>
|
||||||
|
[...laravelForgeConnectionKeys.all, "sites", connectionId, organizationSlug, serverId] as const
|
||||||
|
};
|
||||||
|
|
||||||
|
export const useLaravelForgeConnectionListOrganizations = (
|
||||||
|
connectionId: string,
|
||||||
|
options?: Omit<
|
||||||
|
UseQueryOptions<
|
||||||
|
TLaravelForgeOrganization[],
|
||||||
|
unknown,
|
||||||
|
TLaravelForgeOrganization[],
|
||||||
|
ReturnType<typeof laravelForgeConnectionKeys.listOrganizations>
|
||||||
|
>,
|
||||||
|
"queryKey" | "queryFn"
|
||||||
|
>
|
||||||
|
) => {
|
||||||
|
return useQuery({
|
||||||
|
queryKey: laravelForgeConnectionKeys.listOrganizations(connectionId),
|
||||||
|
queryFn: async () => {
|
||||||
|
const { data } = await apiRequest.get<TLaravelForgeOrganization[]>(
|
||||||
|
`/api/v1/app-connections/laravel-forge/${connectionId}/organizations`
|
||||||
|
);
|
||||||
|
|
||||||
|
return data;
|
||||||
|
},
|
||||||
|
...options
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const useLaravelForgeConnectionListServers = (
|
||||||
|
connectionId: string,
|
||||||
|
organizationSlug: string,
|
||||||
|
options?: Omit<
|
||||||
|
UseQueryOptions<
|
||||||
|
TLaravelForgeServer[],
|
||||||
|
unknown,
|
||||||
|
TLaravelForgeServer[],
|
||||||
|
ReturnType<typeof laravelForgeConnectionKeys.listServers>
|
||||||
|
>,
|
||||||
|
"queryKey" | "queryFn"
|
||||||
|
>
|
||||||
|
) => {
|
||||||
|
return useQuery({
|
||||||
|
queryKey: laravelForgeConnectionKeys.listServers(connectionId, organizationSlug),
|
||||||
|
queryFn: async () => {
|
||||||
|
const params = { organizationSlug };
|
||||||
|
const { data } = await apiRequest.get<TLaravelForgeServer[]>(
|
||||||
|
`/api/v1/app-connections/laravel-forge/${connectionId}/servers`,
|
||||||
|
{ params }
|
||||||
|
);
|
||||||
|
|
||||||
|
return data;
|
||||||
|
},
|
||||||
|
enabled: Boolean(connectionId && organizationSlug),
|
||||||
|
...options
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const useLaravelForgeConnectionListSites = (
|
||||||
|
connectionId: string,
|
||||||
|
organizationSlug: string,
|
||||||
|
serverId: string,
|
||||||
|
options?: Omit<
|
||||||
|
UseQueryOptions<
|
||||||
|
TLaravelForgeSite[],
|
||||||
|
unknown,
|
||||||
|
TLaravelForgeSite[],
|
||||||
|
ReturnType<typeof laravelForgeConnectionKeys.listSites>
|
||||||
|
>,
|
||||||
|
"queryKey" | "queryFn"
|
||||||
|
>
|
||||||
|
) => {
|
||||||
|
return useQuery({
|
||||||
|
queryKey: laravelForgeConnectionKeys.listSites(connectionId, organizationSlug, serverId),
|
||||||
|
queryFn: async () => {
|
||||||
|
const params = {
|
||||||
|
organizationSlug,
|
||||||
|
serverId
|
||||||
|
};
|
||||||
|
|
||||||
|
const { data } = await apiRequest.get<TLaravelForgeSite[]>(
|
||||||
|
`/api/v1/app-connections/laravel-forge/${connectionId}/sites`,
|
||||||
|
{ params }
|
||||||
|
);
|
||||||
|
|
||||||
|
return data;
|
||||||
|
},
|
||||||
|
enabled: Boolean(connectionId && organizationSlug && serverId),
|
||||||
|
...options
|
||||||
|
});
|
||||||
|
};
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
export type TLaravelForgeOrganization = {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
slug: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type TLaravelForgeServer = {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type TLaravelForgeSite = {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
};
|
||||||
@@ -164,6 +164,10 @@ export type TOktaConnectionOption = TAppConnectionOptionBase & {
|
|||||||
app: AppConnection.Okta;
|
app: AppConnection.Okta;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type TLaravelForgeConnectionOption = TAppConnectionOptionBase & {
|
||||||
|
app: AppConnection.LaravelForge;
|
||||||
|
};
|
||||||
|
|
||||||
export type TAzureAdCsConnectionOption = TAppConnectionOptionBase & {
|
export type TAzureAdCsConnectionOption = TAppConnectionOptionBase & {
|
||||||
app: AppConnection.AzureADCS;
|
app: AppConnection.AzureADCS;
|
||||||
};
|
};
|
||||||
@@ -210,7 +214,8 @@ export type TAppConnectionOption =
|
|||||||
| TDigitalOceanConnectionOption
|
| TDigitalOceanConnectionOption
|
||||||
| TNetlifyConnectionOption
|
| TNetlifyConnectionOption
|
||||||
| TOktaConnectionOption
|
| TOktaConnectionOption
|
||||||
| TAzureAdCsConnectionOption;
|
| TAzureAdCsConnectionOption
|
||||||
|
| TLaravelForgeConnectionOption;
|
||||||
|
|
||||||
export type TAppConnectionOptionMap = {
|
export type TAppConnectionOptionMap = {
|
||||||
[AppConnection.AWS]: TAwsConnectionOption;
|
[AppConnection.AWS]: TAwsConnectionOption;
|
||||||
@@ -252,4 +257,5 @@ export type TAppConnectionOptionMap = {
|
|||||||
[AppConnection.Okta]: TOktaConnectionOption;
|
[AppConnection.Okta]: TOktaConnectionOption;
|
||||||
[AppConnection.AzureADCS]: TAzureAdCsConnectionOption;
|
[AppConnection.AzureADCS]: TAzureAdCsConnectionOption;
|
||||||
[AppConnection.Redis]: TRedisConnectionOption;
|
[AppConnection.Redis]: TRedisConnectionOption;
|
||||||
|
[AppConnection.LaravelForge]: TLaravelForgeConnectionOption;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import { TGitLabConnection } from "./gitlab-connection";
|
|||||||
import { THCVaultConnection } from "./hc-vault-connection";
|
import { THCVaultConnection } from "./hc-vault-connection";
|
||||||
import { THerokuConnection } from "./heroku-connection";
|
import { THerokuConnection } from "./heroku-connection";
|
||||||
import { THumanitecConnection } from "./humanitec-connection";
|
import { THumanitecConnection } from "./humanitec-connection";
|
||||||
|
import { TLaravelForgeConnection } from "./laravel-forge-connection";
|
||||||
import { TLdapConnection } from "./ldap-connection";
|
import { TLdapConnection } from "./ldap-connection";
|
||||||
import { TMsSqlConnection } from "./mssql-connection";
|
import { TMsSqlConnection } from "./mssql-connection";
|
||||||
import { TMySqlConnection } from "./mysql-connection";
|
import { TMySqlConnection } from "./mysql-connection";
|
||||||
@@ -61,6 +62,7 @@ export * from "./gitlab-connection";
|
|||||||
export * from "./hc-vault-connection";
|
export * from "./hc-vault-connection";
|
||||||
export * from "./heroku-connection";
|
export * from "./heroku-connection";
|
||||||
export * from "./humanitec-connection";
|
export * from "./humanitec-connection";
|
||||||
|
export * from "./laravel-forge-connection";
|
||||||
export * from "./ldap-connection";
|
export * from "./ldap-connection";
|
||||||
export * from "./mssql-connection";
|
export * from "./mssql-connection";
|
||||||
export * from "./mysql-connection";
|
export * from "./mysql-connection";
|
||||||
@@ -105,6 +107,7 @@ export type TAppConnection =
|
|||||||
| TOCIConnection
|
| TOCIConnection
|
||||||
| TOnePassConnection
|
| TOnePassConnection
|
||||||
| THerokuConnection
|
| THerokuConnection
|
||||||
|
| TLaravelForgeConnection
|
||||||
| TRenderConnection
|
| TRenderConnection
|
||||||
| TFlyioConnection
|
| TFlyioConnection
|
||||||
| TGitLabConnection
|
| TGitLabConnection
|
||||||
|
|||||||
@@ -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;
|
||||||
|
};
|
||||||
|
};
|
||||||
@@ -28,7 +28,8 @@ export enum SecretSync {
|
|||||||
Checkly = "checkly",
|
Checkly = "checkly",
|
||||||
DigitalOceanAppPlatform = "digital-ocean-app-platform",
|
DigitalOceanAppPlatform = "digital-ocean-app-platform",
|
||||||
Netlify = "netlify",
|
Netlify = "netlify",
|
||||||
Bitbucket = "bitbucket"
|
Bitbucket = "bitbucket",
|
||||||
|
LaravelForge = "laravel-forge"
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum SecretSyncStatus {
|
export enum SecretSyncStatus {
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import { TGitLabSync } from "./gitlab-sync";
|
|||||||
import { THCVaultSync } from "./hc-vault-sync";
|
import { THCVaultSync } from "./hc-vault-sync";
|
||||||
import { THerokuSync } from "./heroku-sync";
|
import { THerokuSync } from "./heroku-sync";
|
||||||
import { THumanitecSync } from "./humanitec-sync";
|
import { THumanitecSync } from "./humanitec-sync";
|
||||||
|
import { TLaravelForgeSync } from "./laravel-forge-sync";
|
||||||
import { TNetlifySync } from "./netlify-sync";
|
import { TNetlifySync } from "./netlify-sync";
|
||||||
import { TOCIVaultSync } from "./oci-vault-sync";
|
import { TOCIVaultSync } from "./oci-vault-sync";
|
||||||
import { TRailwaySync } from "./railway-sync";
|
import { TRailwaySync } from "./railway-sync";
|
||||||
@@ -69,7 +70,8 @@ export type TSecretSync =
|
|||||||
| TSupabaseSync
|
| TSupabaseSync
|
||||||
| TDigitalOceanAppPlatformSync
|
| TDigitalOceanAppPlatformSync
|
||||||
| TNetlifySync
|
| TNetlifySync
|
||||||
| TBitbucketSync;
|
| TBitbucketSync
|
||||||
|
| TLaravelForgeSync;
|
||||||
|
|
||||||
export type TListSecretSyncs = { secretSyncs: TSecretSync[] };
|
export type TListSecretSyncs = { secretSyncs: TSecretSync[] };
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
import { AppConnection } from "@app/hooks/api/appConnections/enums";
|
||||||
|
import { SecretSync } from "@app/hooks/api/secretSyncs";
|
||||||
|
import { TRootSecretSync } from "@app/hooks/api/secretSyncs/types/root-sync";
|
||||||
|
|
||||||
|
export type TLaravelForgeSync = TRootSecretSync & {
|
||||||
|
destination: SecretSync.LaravelForge;
|
||||||
|
destinationConfig: {
|
||||||
|
orgSlug: string;
|
||||||
|
orgName: string;
|
||||||
|
serverId: string;
|
||||||
|
serverName: string;
|
||||||
|
siteId: string;
|
||||||
|
siteName: string;
|
||||||
|
};
|
||||||
|
connection: {
|
||||||
|
app: AppConnection.LaravelForge;
|
||||||
|
name: string;
|
||||||
|
id: string;
|
||||||
|
};
|
||||||
|
};
|
||||||
@@ -31,6 +31,7 @@ import { GitLabConnectionForm } from "./GitLabConnectionForm";
|
|||||||
import { HCVaultConnectionForm } from "./HCVaultConnectionForm";
|
import { HCVaultConnectionForm } from "./HCVaultConnectionForm";
|
||||||
import { HerokuConnectionForm } from "./HerokuAppConnectionForm";
|
import { HerokuConnectionForm } from "./HerokuAppConnectionForm";
|
||||||
import { HumanitecConnectionForm } from "./HumanitecConnectionForm";
|
import { HumanitecConnectionForm } from "./HumanitecConnectionForm";
|
||||||
|
import { LaravelForgeConnectionForm } from "./LaravelForgeConnectionForm";
|
||||||
import { LdapConnectionForm } from "./LdapConnectionForm";
|
import { LdapConnectionForm } from "./LdapConnectionForm";
|
||||||
import { MsSqlConnectionForm } from "./MsSqlConnectionForm";
|
import { MsSqlConnectionForm } from "./MsSqlConnectionForm";
|
||||||
import { MySqlConnectionForm } from "./MySqlConnectionForm";
|
import { MySqlConnectionForm } from "./MySqlConnectionForm";
|
||||||
@@ -146,6 +147,8 @@ const CreateForm = ({ app, onComplete, projectId }: CreateFormProps) => {
|
|||||||
return <HerokuConnectionForm onSubmit={onSubmit} projectId={projectId} />;
|
return <HerokuConnectionForm onSubmit={onSubmit} projectId={projectId} />;
|
||||||
case AppConnection.Render:
|
case AppConnection.Render:
|
||||||
return <RenderConnectionForm onSubmit={onSubmit} />;
|
return <RenderConnectionForm onSubmit={onSubmit} />;
|
||||||
|
case AppConnection.LaravelForge:
|
||||||
|
return <LaravelForgeConnectionForm onSubmit={onSubmit} />;
|
||||||
case AppConnection.Flyio:
|
case AppConnection.Flyio:
|
||||||
return <FlyioConnectionForm onSubmit={onSubmit} />;
|
return <FlyioConnectionForm onSubmit={onSubmit} />;
|
||||||
case AppConnection.GitLab:
|
case AppConnection.GitLab:
|
||||||
@@ -297,6 +300,8 @@ const UpdateForm = ({ appConnection, onComplete }: UpdateFormProps) => {
|
|||||||
);
|
);
|
||||||
case AppConnection.Render:
|
case AppConnection.Render:
|
||||||
return <RenderConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;
|
return <RenderConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;
|
||||||
|
case AppConnection.LaravelForge:
|
||||||
|
return <LaravelForgeConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;
|
||||||
case AppConnection.Flyio:
|
case AppConnection.Flyio:
|
||||||
return <FlyioConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;
|
return <FlyioConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;
|
||||||
case AppConnection.GitLab:
|
case AppConnection.GitLab:
|
||||||
|
|||||||
@@ -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>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -19,7 +19,7 @@ export const AppConnectionHeader = ({ app, isConnected, onBack }: Props) => {
|
|||||||
<img
|
<img
|
||||||
alt={`${appDetails.name} logo`}
|
alt={`${appDetails.name} logo`}
|
||||||
src={`/images/integrations/${appDetails.image}`}
|
src={`/images/integrations/${appDetails.image}`}
|
||||||
className="h-12 w-12 rounded-md bg-bunker-500 p-2"
|
className="h-12 w-12 rounded-md bg-bunker-500 object-contain p-2"
|
||||||
/>
|
/>
|
||||||
{appDetails.icon && (
|
{appDetails.icon && (
|
||||||
<FontAwesomeIcon
|
<FontAwesomeIcon
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ export const AppConnectionsSelect = ({ onSelect, projectType }: Props) => {
|
|||||||
}
|
}
|
||||||
className="group relative flex h-28 cursor-pointer flex-col items-center justify-center rounded-md border border-mineshaft-600 bg-mineshaft-700 p-4 duration-200 hover:bg-mineshaft-600"
|
className="group relative flex h-28 cursor-pointer flex-col items-center justify-center rounded-md border border-mineshaft-600 bg-mineshaft-700 p-4 duration-200 hover:bg-mineshaft-600"
|
||||||
>
|
>
|
||||||
<div className="relative">
|
{image && (
|
||||||
<img
|
<img
|
||||||
src={`/images/integrations/${image}`}
|
src={`/images/integrations/${image}`}
|
||||||
style={{
|
style={{
|
||||||
@@ -89,14 +89,16 @@ export const AppConnectionsSelect = ({ onSelect, projectType }: Props) => {
|
|||||||
className="mt-auto"
|
className="mt-auto"
|
||||||
alt={`${name} logo`}
|
alt={`${name} logo`}
|
||||||
/>
|
/>
|
||||||
{icon && (
|
)}
|
||||||
|
{icon && (
|
||||||
|
<div className="relative">
|
||||||
<FontAwesomeIcon
|
<FontAwesomeIcon
|
||||||
className="absolute -right-1.5 -bottom-1.5 text-primary-700"
|
className="absolute -right-1.5 -bottom-1.5 text-primary-700"
|
||||||
size="xl"
|
size="xl"
|
||||||
icon={icon}
|
icon={icon}
|
||||||
/>
|
/>
|
||||||
)}
|
</div>
|
||||||
</div>
|
)}
|
||||||
<div className="mt-auto max-w-xs text-center text-xs font-medium text-gray-300 duration-200 group-hover:text-gray-200">
|
<div className="mt-auto max-w-xs text-center text-xs font-medium text-gray-300 duration-200 group-hover:text-gray-200">
|
||||||
{name}
|
{name}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
import { TLaravelForgeSync } from "@app/hooks/api/secretSyncs/types/laravel-forge-sync";
|
||||||
|
|
||||||
|
import { getSecretSyncDestinationColValues } from "../helpers";
|
||||||
|
import { SecretSyncTableCell } from "../SecretSyncTableCell";
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
secretSync: TLaravelForgeSync;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const LaravelForgeSyncDestinationCol = ({ secretSync }: Props) => {
|
||||||
|
const { primaryText, secondaryText } = getSecretSyncDestinationColValues(secretSync);
|
||||||
|
|
||||||
|
return <SecretSyncTableCell primaryText={primaryText} secondaryText={secondaryText} />;
|
||||||
|
};
|
||||||
@@ -20,6 +20,7 @@ import { GitLabSyncDestinationCol } from "./GitLabSyncDestinationCol";
|
|||||||
import { HCVaultSyncDestinationCol } from "./HCVaultSyncDestinationCol";
|
import { HCVaultSyncDestinationCol } from "./HCVaultSyncDestinationCol";
|
||||||
import { HerokuSyncDestinationCol } from "./HerokuSyncDestinationCol";
|
import { HerokuSyncDestinationCol } from "./HerokuSyncDestinationCol";
|
||||||
import { HumanitecSyncDestinationCol } from "./HumanitecSyncDestinationCol";
|
import { HumanitecSyncDestinationCol } from "./HumanitecSyncDestinationCol";
|
||||||
|
import { LaravelForgeSyncDestinationCol } from "./LaravelForgeSyncDestinationCol";
|
||||||
import { NetlifySyncDestinationCol } from "./NetlifySyncDestinationCol";
|
import { NetlifySyncDestinationCol } from "./NetlifySyncDestinationCol";
|
||||||
import { OCIVaultSyncDestinationCol } from "./OCIVaultSyncDestinationCol";
|
import { OCIVaultSyncDestinationCol } from "./OCIVaultSyncDestinationCol";
|
||||||
import { RailwaySyncDestinationCol } from "./RailwaySyncDestinationCol";
|
import { RailwaySyncDestinationCol } from "./RailwaySyncDestinationCol";
|
||||||
@@ -97,6 +98,8 @@ export const SecretSyncDestinationCol = ({ secretSync }: Props) => {
|
|||||||
return <NetlifySyncDestinationCol secretSync={secretSync} />;
|
return <NetlifySyncDestinationCol secretSync={secretSync} />;
|
||||||
case SecretSync.Bitbucket:
|
case SecretSync.Bitbucket:
|
||||||
return <BitbucketSyncDestinationCol secretSync={secretSync} />;
|
return <BitbucketSyncDestinationCol secretSync={secretSync} />;
|
||||||
|
case SecretSync.LaravelForge:
|
||||||
|
return <LaravelForgeSyncDestinationCol secretSync={secretSync} />;
|
||||||
default:
|
default:
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Unhandled Secret Sync Destination Col: ${(secretSync as TSecretSync).destination}`
|
`Unhandled Secret Sync Destination Col: ${(secretSync as TSecretSync).destination}`
|
||||||
|
|||||||
@@ -194,6 +194,10 @@ export const getSecretSyncDestinationColValues = (secretSync: TSecretSync) => {
|
|||||||
primaryText = destinationConfig.workspaceSlug;
|
primaryText = destinationConfig.workspaceSlug;
|
||||||
secondaryText = destinationConfig.repositorySlug;
|
secondaryText = destinationConfig.repositorySlug;
|
||||||
break;
|
break;
|
||||||
|
case SecretSync.LaravelForge:
|
||||||
|
primaryText = destinationConfig.siteName || destinationConfig.siteId;
|
||||||
|
secondaryText = destinationConfig.orgName || destinationConfig.orgSlug;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
throw new Error(`Unhandled Destination Col Values ${destination}`);
|
throw new Error(`Unhandled Destination Col Values ${destination}`);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
import { GenericFieldLabel } from "@app/components/secret-syncs";
|
||||||
|
import { TLaravelForgeSync } from "@app/hooks/api/secretSyncs/types/laravel-forge-sync";
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
secretSync: TLaravelForgeSync;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const LaravelForgeSyncDestinationSection = ({ secretSync }: Props) => {
|
||||||
|
const { destinationConfig } = secretSync;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<GenericFieldLabel label="Account">
|
||||||
|
{destinationConfig.orgName || destinationConfig.orgSlug}
|
||||||
|
</GenericFieldLabel>
|
||||||
|
<GenericFieldLabel label="Server">
|
||||||
|
{destinationConfig.serverName || destinationConfig.serverId}
|
||||||
|
</GenericFieldLabel>
|
||||||
|
<GenericFieldLabel label="Site">
|
||||||
|
{destinationConfig.siteName || destinationConfig.siteId}
|
||||||
|
</GenericFieldLabel>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -31,6 +31,7 @@ import { GitLabSyncDestinationSection } from "./GitLabSyncDestinationSection";
|
|||||||
import { HCVaultSyncDestinationSection } from "./HCVaultSyncDestinationSection";
|
import { HCVaultSyncDestinationSection } from "./HCVaultSyncDestinationSection";
|
||||||
import { HerokuSyncDestinationSection } from "./HerokuSyncDestinationSection";
|
import { HerokuSyncDestinationSection } from "./HerokuSyncDestinationSection";
|
||||||
import { HumanitecSyncDestinationSection } from "./HumanitecSyncDestinationSection";
|
import { HumanitecSyncDestinationSection } from "./HumanitecSyncDestinationSection";
|
||||||
|
import { LaravelForgeSyncDestinationSection } from "./LaravelForgeSyncDestinationSection";
|
||||||
import { NetlifySyncDestinationSection } from "./NetlifySyncDestinationSection";
|
import { NetlifySyncDestinationSection } from "./NetlifySyncDestinationSection";
|
||||||
import { OCIVaultSyncDestinationSection } from "./OCIVaultSyncDestinationSection";
|
import { OCIVaultSyncDestinationSection } from "./OCIVaultSyncDestinationSection";
|
||||||
import { RailwaySyncDestinationSection } from "./RailwaySyncDestinationSection";
|
import { RailwaySyncDestinationSection } from "./RailwaySyncDestinationSection";
|
||||||
@@ -148,6 +149,9 @@ export const SecretSyncDestinationSection = ({ secretSync, onEditDestination }:
|
|||||||
case SecretSync.Bitbucket:
|
case SecretSync.Bitbucket:
|
||||||
DestinationComponents = <BitbucketSyncDestinationSection secretSync={secretSync} />;
|
DestinationComponents = <BitbucketSyncDestinationSection secretSync={secretSync} />;
|
||||||
break;
|
break;
|
||||||
|
case SecretSync.LaravelForge:
|
||||||
|
DestinationComponents = <LaravelForgeSyncDestinationSection secretSync={secretSync} />;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
throw new Error(`Unhandled Destination Section components: ${destination}`);
|
throw new Error(`Unhandled Destination Section components: ${destination}`);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ export const SecretSyncOptionsSection = ({ secretSync, onEditOptions }: Props) =
|
|||||||
case SecretSync.DigitalOceanAppPlatform:
|
case SecretSync.DigitalOceanAppPlatform:
|
||||||
case SecretSync.Netlify:
|
case SecretSync.Netlify:
|
||||||
case SecretSync.Bitbucket:
|
case SecretSync.Bitbucket:
|
||||||
|
case SecretSync.LaravelForge:
|
||||||
AdditionalSyncOptionsComponent = null;
|
AdditionalSyncOptionsComponent = null;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||