feat: secret sync foundation

This commit is contained in:
Piyush Gupta
2025-10-13 17:15:54 +05:30
parent d260e40a3b
commit 5b765841b7
25 changed files with 783 additions and 15 deletions
@@ -0,0 +1,3 @@
export * from "./laravel-forge-sync-constants";
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,48 @@
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 LaravelForgeSyncDestinationConfigSchema = z.object({
orgSlug: z.string().min(1, "Org Slug is required").describe(SecretSyncs.DESTINATION_CONFIG.LARAVEL_FORGE.orgSlug),
serverId: z.string().min(1, "Server ID is required").describe(SecretSyncs.DESTINATION_CONFIG.LARAVEL_FORGE.serverId),
siteId: z.string().min(1, "Site ID is required").describe(SecretSyncs.DESTINATION_CONFIG.LARAVEL_FORGE.siteId)
});
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 LaravelForgeSecret = {
description: string;
is_secret: boolean;
key: string;
source: "app" | "env";
value: string;
};
export interface LaravelForgeApiSecret {
id: string;
key: string;
value: string;
type: string;
target: string[];
customEnvironmentIds?: string[];
gitBranch?: string;
createdAt?: number;
updatedAt?: number;
configurationId?: string;
system?: boolean;
}
@@ -49,6 +49,7 @@ import { HC_VAULT_SYNC_LIST_OPTION, HCVaultSyncFns } from "./hc-vault";
import { HEROKU_SYNC_LIST_OPTION, HerokuSyncFns } from "./heroku";
import { HUMANITEC_SYNC_LIST_OPTION } from "./humanitec";
import { HumanitecSyncFns } from "./humanitec/humanitec-sync-fns";
import { LARAVEL_FORGE_SYNC_LIST_OPTION } from "./laravel-forge";
import { NETLIFY_SYNC_LIST_OPTION, NetlifySyncFns } from "./netlify";
import { RAILWAY_SYNC_LIST_OPTION } from "./railway/railway-sync-constants";
import { RailwaySyncFns } from "./railway/railway-sync-fns";
@@ -91,7 +92,8 @@ const SECRET_SYNC_LIST_OPTIONS: Record<SecretSync, TSecretSyncListItem> = {
[SecretSync.Checkly]: CHECKLY_SYNC_LIST_OPTION,
[SecretSync.DigitalOceanAppPlatform]: DIGITAL_OCEAN_APP_PLATFORM_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 = () => {
@@ -117,6 +117,12 @@ import {
THumanitecSyncListItem,
THumanitecSyncWithCredentials
} from "./humanitec";
import {
TLaravelForgeSync,
TLaravelForgeSyncInput,
TLaravelForgeSyncListItem,
TLaravelForgeSyncWithCredentials
} from "./laravel-forge";
import { TNetlifySync, TNetlifySyncInput, TNetlifySyncListItem, TNetlifySyncWithCredentials } from "./netlify";
import {
TRailwaySync,
@@ -164,6 +170,7 @@ export type TSecretSync =
| TTerraformCloudSync
| TCamundaSync
| TVercelSync
| TLaravelForgeSync
| TWindmillSync
| THCVaultSync
| TTeamCitySync
@@ -212,7 +219,8 @@ export type TSecretSyncWithCredentials =
| TSupabaseSyncWithCredentials
| TDigitalOceanAppPlatformSyncWithCredentials
| TNetlifySyncWithCredentials
| TBitbucketSyncWithCredentials;
| TBitbucketSyncWithCredentials
| TLaravelForgeSyncWithCredentials;
export type TSecretSyncInput =
| TAwsParameterStoreSyncInput
@@ -244,7 +252,8 @@ export type TSecretSyncInput =
| TSupabaseSyncInput
| TDigitalOceanAppPlatformSyncInput
| TNetlifySyncInput
| TBitbucketSyncInput;
| TBitbucketSyncInput
| TLaravelForgeSyncInput;
export type TSecretSyncListItem =
| TAwsParameterStoreSyncListItem
@@ -259,6 +268,7 @@ export type TSecretSyncListItem =
| TTerraformCloudSyncListItem
| TCamundaSyncListItem
| TVercelSyncListItem
| TLaravelForgeSyncListItem
| TWindmillSyncListItem
| THCVaultSyncListItem
| TTeamCitySyncListItem