Merge pull request #3791 from Infisical/feat/add-render-app-connection-and-secret-sync
feat: render app connection and secret sync
@@ -2390,6 +2390,11 @@ export const SecretSyncs = {
|
||||
ONEPASS: {
|
||||
vaultId: "The ID of the 1Password vault to sync secrets to."
|
||||
},
|
||||
RENDER: {
|
||||
serviceId: "The ID of the Render service to sync secrets to.",
|
||||
scope: "The Render scope that secrets should be synced to.",
|
||||
type: "The Render resource type to sync secrets to."
|
||||
},
|
||||
FLYIO: {
|
||||
appId: "The ID of the Fly.io app to sync secrets to."
|
||||
}
|
||||
|
||||
@@ -61,6 +61,10 @@ import {
|
||||
PostgresConnectionListItemSchema,
|
||||
SanitizedPostgresConnectionSchema
|
||||
} from "@app/services/app-connection/postgres";
|
||||
import {
|
||||
RenderConnectionListItemSchema,
|
||||
SanitizedRenderConnectionSchema
|
||||
} from "@app/services/app-connection/render/render-connection-schema";
|
||||
import {
|
||||
SanitizedTeamCityConnectionSchema,
|
||||
TeamCityConnectionListItemSchema
|
||||
@@ -102,6 +106,7 @@ const SanitizedAppConnectionSchema = z.union([
|
||||
...SanitizedOCIConnectionSchema.options,
|
||||
...SanitizedOracleDBConnectionSchema.options,
|
||||
...SanitizedOnePassConnectionSchema.options,
|
||||
...SanitizedRenderConnectionSchema.options,
|
||||
...SanitizedFlyioConnectionSchema.options
|
||||
]);
|
||||
|
||||
@@ -130,6 +135,7 @@ const AppConnectionOptionsSchema = z.discriminatedUnion("app", [
|
||||
OCIConnectionListItemSchema,
|
||||
OracleDBConnectionListItemSchema,
|
||||
OnePassConnectionListItemSchema,
|
||||
RenderConnectionListItemSchema,
|
||||
FlyioConnectionListItemSchema
|
||||
]);
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ import { registerLdapConnectionRouter } from "./ldap-connection-router";
|
||||
import { registerMsSqlConnectionRouter } from "./mssql-connection-router";
|
||||
import { registerMySqlConnectionRouter } from "./mysql-connection-router";
|
||||
import { registerPostgresConnectionRouter } from "./postgres-connection-router";
|
||||
import { registerRenderConnectionRouter } from "./render-connection-router";
|
||||
import { registerTeamCityConnectionRouter } from "./teamcity-connection-router";
|
||||
import { registerTerraformCloudConnectionRouter } from "./terraform-cloud-router";
|
||||
import { registerVercelConnectionRouter } from "./vercel-connection-router";
|
||||
@@ -54,5 +55,6 @@ export const APP_CONNECTION_REGISTER_ROUTER_MAP: Record<AppConnection, (server:
|
||||
[AppConnection.OCI]: registerOCIConnectionRouter,
|
||||
[AppConnection.OracleDB]: registerOracleDBConnectionRouter,
|
||||
[AppConnection.OnePass]: registerOnePassConnectionRouter,
|
||||
[AppConnection.Render]: registerRenderConnectionRouter,
|
||||
[AppConnection.Flyio]: registerFlyioConnectionRouter
|
||||
};
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
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 {
|
||||
CreateRenderConnectionSchema,
|
||||
SanitizedRenderConnectionSchema,
|
||||
UpdateRenderConnectionSchema
|
||||
} from "@app/services/app-connection/render/render-connection-schema";
|
||||
import { AuthMode } from "@app/services/auth/auth-type";
|
||||
|
||||
import { registerAppConnectionEndpoints } from "./app-connection-endpoints";
|
||||
|
||||
export const registerRenderConnectionRouter = async (server: FastifyZodProvider) => {
|
||||
registerAppConnectionEndpoints({
|
||||
app: AppConnection.Render,
|
||||
server,
|
||||
sanitizedResponseSchema: SanitizedRenderConnectionSchema,
|
||||
createSchema: CreateRenderConnectionSchema,
|
||||
updateSchema: UpdateRenderConnectionSchema
|
||||
});
|
||||
|
||||
// The below endpoints are not exposed and for Infisical App use
|
||||
server.route({
|
||||
method: "GET",
|
||||
url: `/:connectionId/services`,
|
||||
config: {
|
||||
rateLimit: readLimit
|
||||
},
|
||||
schema: {
|
||||
params: z.object({
|
||||
connectionId: z.string().uuid()
|
||||
}),
|
||||
response: {
|
||||
200: z
|
||||
.object({
|
||||
id: z.string(),
|
||||
name: z.string()
|
||||
})
|
||||
.array()
|
||||
}
|
||||
},
|
||||
onRequest: verifyAuth([AuthMode.JWT]),
|
||||
handler: async (req) => {
|
||||
const { connectionId } = req.params;
|
||||
const services = await server.services.appConnection.render.listServices(connectionId, req.permission);
|
||||
|
||||
return services;
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -14,6 +14,7 @@ import { registerGcpSyncRouter } from "./gcp-sync-router";
|
||||
import { registerGitHubSyncRouter } from "./github-sync-router";
|
||||
import { registerHCVaultSyncRouter } from "./hc-vault-sync-router";
|
||||
import { registerHumanitecSyncRouter } from "./humanitec-sync-router";
|
||||
import { registerRenderSyncRouter } from "./render-sync-router";
|
||||
import { registerTeamCitySyncRouter } from "./teamcity-sync-router";
|
||||
import { registerTerraformCloudSyncRouter } from "./terraform-cloud-sync-router";
|
||||
import { registerVercelSyncRouter } from "./vercel-sync-router";
|
||||
@@ -39,5 +40,6 @@ export const SECRET_SYNC_REGISTER_ROUTER_MAP: Record<SecretSync, (server: Fastif
|
||||
[SecretSync.TeamCity]: registerTeamCitySyncRouter,
|
||||
[SecretSync.OCIVault]: registerOCIVaultSyncRouter,
|
||||
[SecretSync.OnePass]: registerOnePassSyncRouter,
|
||||
[SecretSync.Render]: registerRenderSyncRouter,
|
||||
[SecretSync.Flyio]: registerFlyioSyncRouter
|
||||
};
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import {
|
||||
CreateRenderSyncSchema,
|
||||
RenderSyncSchema,
|
||||
UpdateRenderSyncSchema
|
||||
} from "@app/services/secret-sync/render/render-sync-schemas";
|
||||
import { SecretSync } from "@app/services/secret-sync/secret-sync-enums";
|
||||
|
||||
import { registerSyncSecretsEndpoints } from "./secret-sync-endpoints";
|
||||
|
||||
export const registerRenderSyncRouter = async (server: FastifyZodProvider) =>
|
||||
registerSyncSecretsEndpoints({
|
||||
destination: SecretSync.Render,
|
||||
server,
|
||||
responseSchema: RenderSyncSchema,
|
||||
createSchema: CreateRenderSyncSchema,
|
||||
updateSchema: UpdateRenderSyncSchema
|
||||
});
|
||||
@@ -28,6 +28,7 @@ import { GcpSyncListItemSchema, GcpSyncSchema } from "@app/services/secret-sync/
|
||||
import { GitHubSyncListItemSchema, GitHubSyncSchema } from "@app/services/secret-sync/github";
|
||||
import { HCVaultSyncListItemSchema, HCVaultSyncSchema } from "@app/services/secret-sync/hc-vault";
|
||||
import { HumanitecSyncListItemSchema, HumanitecSyncSchema } from "@app/services/secret-sync/humanitec";
|
||||
import { RenderSyncListItemSchema, RenderSyncSchema } from "@app/services/secret-sync/render/render-sync-schemas";
|
||||
import { TeamCitySyncListItemSchema, TeamCitySyncSchema } from "@app/services/secret-sync/teamcity";
|
||||
import { TerraformCloudSyncListItemSchema, TerraformCloudSyncSchema } from "@app/services/secret-sync/terraform-cloud";
|
||||
import { VercelSyncListItemSchema, VercelSyncSchema } from "@app/services/secret-sync/vercel";
|
||||
@@ -51,6 +52,7 @@ const SecretSyncSchema = z.discriminatedUnion("destination", [
|
||||
TeamCitySyncSchema,
|
||||
OCIVaultSyncSchema,
|
||||
OnePassSyncSchema,
|
||||
RenderSyncSchema,
|
||||
FlyioSyncSchema
|
||||
]);
|
||||
|
||||
@@ -72,6 +74,7 @@ const SecretSyncOptionsSchema = z.discriminatedUnion("destination", [
|
||||
TeamCitySyncListItemSchema,
|
||||
OCIVaultSyncListItemSchema,
|
||||
OnePassSyncListItemSchema,
|
||||
RenderSyncListItemSchema,
|
||||
FlyioSyncListItemSchema
|
||||
]);
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ export enum AppConnection {
|
||||
OCI = "oci",
|
||||
OracleDB = "oracledb",
|
||||
OnePass = "1password",
|
||||
Render = "render",
|
||||
Flyio = "flyio"
|
||||
}
|
||||
|
||||
|
||||
@@ -79,6 +79,8 @@ import { getMsSqlConnectionListItem, MsSqlConnectionMethod } from "./mssql";
|
||||
import { MySqlConnectionMethod } from "./mysql/mysql-connection-enums";
|
||||
import { getMySqlConnectionListItem } from "./mysql/mysql-connection-fns";
|
||||
import { getPostgresConnectionListItem, PostgresConnectionMethod } from "./postgres";
|
||||
import { RenderConnectionMethod } from "./render/render-connection-enums";
|
||||
import { getRenderConnectionListItem, validateRenderConnectionCredentials } from "./render/render-connection-fns";
|
||||
import {
|
||||
getTeamCityConnectionListItem,
|
||||
TeamCityConnectionMethod,
|
||||
@@ -123,6 +125,7 @@ export const listAppConnectionOptions = () => {
|
||||
getOCIConnectionListItem(),
|
||||
getOracleDBConnectionListItem(),
|
||||
getOnePassConnectionListItem(),
|
||||
getRenderConnectionListItem(),
|
||||
getFlyioConnectionListItem()
|
||||
].sort((a, b) => a.name.localeCompare(b.name));
|
||||
};
|
||||
@@ -199,6 +202,7 @@ export const validateAppConnectionCredentials = async (
|
||||
[AppConnection.OCI]: validateOCIConnectionCredentials as TAppConnectionCredentialsValidator,
|
||||
[AppConnection.OracleDB]: validateSqlConnectionCredentials as TAppConnectionCredentialsValidator,
|
||||
[AppConnection.OnePass]: validateOnePassConnectionCredentials as TAppConnectionCredentialsValidator,
|
||||
[AppConnection.Render]: validateRenderConnectionCredentials as TAppConnectionCredentialsValidator,
|
||||
[AppConnection.Flyio]: validateFlyioConnectionCredentials as TAppConnectionCredentialsValidator
|
||||
};
|
||||
|
||||
@@ -249,6 +253,8 @@ export const getAppConnectionMethodName = (method: TAppConnection["method"]) =>
|
||||
return "App Role";
|
||||
case LdapConnectionMethod.SimpleBind:
|
||||
return "Simple Bind";
|
||||
case RenderConnectionMethod.ApiKey:
|
||||
return "API Key";
|
||||
default:
|
||||
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
||||
throw new Error(`Unhandled App Connection Method: ${method}`);
|
||||
@@ -304,6 +310,7 @@ export const TRANSITION_CONNECTION_CREDENTIALS_TO_PLATFORM: Record<
|
||||
[AppConnection.OCI]: platformManagedCredentialsNotSupported,
|
||||
[AppConnection.OracleDB]: transferSqlConnectionCredentialsToPlatform as TAppConnectionTransitionCredentialsToPlatform,
|
||||
[AppConnection.OnePass]: platformManagedCredentialsNotSupported,
|
||||
[AppConnection.Render]: platformManagedCredentialsNotSupported,
|
||||
[AppConnection.Flyio]: platformManagedCredentialsNotSupported
|
||||
};
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ export const APP_CONNECTION_NAME_MAP: Record<AppConnection, string> = {
|
||||
[AppConnection.OCI]: "OCI",
|
||||
[AppConnection.OracleDB]: "OracleDB",
|
||||
[AppConnection.OnePass]: "1Password",
|
||||
[AppConnection.Render]: "Render",
|
||||
[AppConnection.Flyio]: "Fly.io"
|
||||
};
|
||||
|
||||
@@ -53,5 +54,6 @@ export const APP_CONNECTION_PLAN_MAP: Record<AppConnection, AppConnectionPlanTyp
|
||||
[AppConnection.OracleDB]: AppConnectionPlanType.Enterprise,
|
||||
[AppConnection.OnePass]: AppConnectionPlanType.Regular,
|
||||
[AppConnection.MySql]: AppConnectionPlanType.Regular,
|
||||
[AppConnection.Render]: AppConnectionPlanType.Regular,
|
||||
[AppConnection.Flyio]: AppConnectionPlanType.Regular
|
||||
};
|
||||
|
||||
@@ -64,6 +64,8 @@ import { ValidateLdapConnectionCredentialsSchema } from "./ldap";
|
||||
import { ValidateMsSqlConnectionCredentialsSchema } from "./mssql";
|
||||
import { ValidateMySqlConnectionCredentialsSchema } from "./mysql";
|
||||
import { ValidatePostgresConnectionCredentialsSchema } from "./postgres";
|
||||
import { ValidateRenderConnectionCredentialsSchema } from "./render/render-connection-schema";
|
||||
import { renderConnectionService } from "./render/render-connection-service";
|
||||
import { ValidateTeamCityConnectionCredentialsSchema } from "./teamcity";
|
||||
import { teamcityConnectionService } from "./teamcity/teamcity-connection-service";
|
||||
import { ValidateTerraformCloudConnectionCredentialsSchema } from "./terraform-cloud";
|
||||
@@ -107,6 +109,7 @@ const VALIDATE_APP_CONNECTION_CREDENTIALS_MAP: Record<AppConnection, TValidateAp
|
||||
[AppConnection.OCI]: ValidateOCIConnectionCredentialsSchema,
|
||||
[AppConnection.OracleDB]: ValidateOracleDBConnectionCredentialsSchema,
|
||||
[AppConnection.OnePass]: ValidateOnePassConnectionCredentialsSchema,
|
||||
[AppConnection.Render]: ValidateRenderConnectionCredentialsSchema,
|
||||
[AppConnection.Flyio]: ValidateFlyioConnectionCredentialsSchema
|
||||
};
|
||||
|
||||
@@ -513,6 +516,7 @@ export const appConnectionServiceFactory = ({
|
||||
teamcity: teamcityConnectionService(connectAppConnectionById),
|
||||
oci: ociConnectionService(connectAppConnectionById, licenseService),
|
||||
onepass: onePassConnectionService(connectAppConnectionById),
|
||||
render: renderConnectionService(connectAppConnectionById),
|
||||
flyio: flyioConnectionService(connectAppConnectionById)
|
||||
};
|
||||
};
|
||||
|
||||
@@ -117,6 +117,12 @@ import {
|
||||
TPostgresConnectionInput,
|
||||
TValidatePostgresConnectionCredentialsSchema
|
||||
} from "./postgres";
|
||||
import {
|
||||
TRenderConnection,
|
||||
TRenderConnectionConfig,
|
||||
TRenderConnectionInput,
|
||||
TValidateRenderConnectionCredentialsSchema
|
||||
} from "./render/render-connection-types";
|
||||
import {
|
||||
TTeamCityConnection,
|
||||
TTeamCityConnectionConfig,
|
||||
@@ -167,6 +173,7 @@ export type TAppConnection = { id: string } & (
|
||||
| TOCIConnection
|
||||
| TOracleDBConnection
|
||||
| TOnePassConnection
|
||||
| TRenderConnection
|
||||
| TFlyioConnection
|
||||
);
|
||||
|
||||
@@ -199,6 +206,7 @@ export type TAppConnectionInput = { id: string } & (
|
||||
| TOCIConnectionInput
|
||||
| TOracleDBConnectionInput
|
||||
| TOnePassConnectionInput
|
||||
| TRenderConnectionInput
|
||||
| TFlyioConnectionInput
|
||||
);
|
||||
|
||||
@@ -239,6 +247,7 @@ export type TAppConnectionConfig =
|
||||
| TTeamCityConnectionConfig
|
||||
| TOCIConnectionConfig
|
||||
| TOnePassConnectionConfig
|
||||
| TRenderConnectionConfig
|
||||
| TFlyioConnectionConfig;
|
||||
|
||||
export type TValidateAppConnectionCredentialsSchema =
|
||||
@@ -266,6 +275,7 @@ export type TValidateAppConnectionCredentialsSchema =
|
||||
| TValidateOCIConnectionCredentialsSchema
|
||||
| TValidateOracleDBConnectionCredentialsSchema
|
||||
| TValidateOnePassConnectionCredentialsSchema
|
||||
| TValidateRenderConnectionCredentialsSchema
|
||||
| TValidateFlyioConnectionCredentialsSchema;
|
||||
|
||||
export type TListAwsConnectionKmsKeys = {
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
export enum RenderConnectionMethod {
|
||||
ApiKey = "api-key"
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
/* eslint-disable no-await-in-loop */
|
||||
import { AxiosError } from "axios";
|
||||
|
||||
import { request } from "@app/lib/config/request";
|
||||
import { BadRequestError } from "@app/lib/errors";
|
||||
import { IntegrationUrls } from "@app/services/integration-auth/integration-list";
|
||||
|
||||
import { AppConnection } from "../app-connection-enums";
|
||||
import { RenderConnectionMethod } from "./render-connection-enums";
|
||||
import {
|
||||
TRawRenderService,
|
||||
TRenderConnection,
|
||||
TRenderConnectionConfig,
|
||||
TRenderService
|
||||
} from "./render-connection-types";
|
||||
|
||||
export const getRenderConnectionListItem = () => {
|
||||
return {
|
||||
name: "Render" as const,
|
||||
app: AppConnection.Render as const,
|
||||
methods: Object.values(RenderConnectionMethod) as [RenderConnectionMethod.ApiKey]
|
||||
};
|
||||
};
|
||||
|
||||
export const listRenderServices = async (appConnection: TRenderConnection): Promise<TRenderService[]> => {
|
||||
const {
|
||||
credentials: { apiKey }
|
||||
} = appConnection;
|
||||
|
||||
const services: TRenderService[] = [];
|
||||
let hasMorePages = true;
|
||||
const perPage = 100;
|
||||
let cursor;
|
||||
|
||||
while (hasMorePages) {
|
||||
const res: TRawRenderService[] = (
|
||||
await request.get<TRawRenderService[]>(`${IntegrationUrls.RENDER_API_URL}/v1/services`, {
|
||||
params: new URLSearchParams({
|
||||
...(cursor ? { cursor: String(cursor) } : {}),
|
||||
limit: String(perPage)
|
||||
}),
|
||||
headers: {
|
||||
Authorization: `Bearer ${apiKey}`,
|
||||
Accept: "application/json",
|
||||
"Accept-Encoding": "application/json"
|
||||
}
|
||||
})
|
||||
).data;
|
||||
|
||||
res.forEach((item) => {
|
||||
services.push({
|
||||
name: item.service.name,
|
||||
id: item.service.id
|
||||
});
|
||||
});
|
||||
|
||||
if (res.length < perPage) {
|
||||
hasMorePages = false;
|
||||
} else {
|
||||
cursor = res[res.length - 1].cursor;
|
||||
}
|
||||
}
|
||||
|
||||
return services;
|
||||
};
|
||||
|
||||
export const validateRenderConnectionCredentials = async (config: TRenderConnectionConfig) => {
|
||||
const { credentials: inputCredentials } = config;
|
||||
|
||||
try {
|
||||
await request.get(`${IntegrationUrls.RENDER_API_URL}/v1/users`, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${inputCredentials.apiKey}`
|
||||
}
|
||||
});
|
||||
} catch (error: unknown) {
|
||||
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;
|
||||
};
|
||||
@@ -0,0 +1,56 @@
|
||||
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 { RenderConnectionMethod } from "./render-connection-enums";
|
||||
|
||||
export const RenderConnectionApiKeyCredentialsSchema = z.object({
|
||||
apiKey: z.string().trim().min(1, "API key required").max(256, "API key cannot exceed 256 characters")
|
||||
});
|
||||
|
||||
const BaseRenderConnectionSchema = BaseAppConnectionSchema.extend({ app: z.literal(AppConnection.Render) });
|
||||
|
||||
export const RenderConnectionSchema = BaseRenderConnectionSchema.extend({
|
||||
method: z.literal(RenderConnectionMethod.ApiKey),
|
||||
credentials: RenderConnectionApiKeyCredentialsSchema
|
||||
});
|
||||
|
||||
export const SanitizedRenderConnectionSchema = z.discriminatedUnion("method", [
|
||||
BaseRenderConnectionSchema.extend({
|
||||
method: z.literal(RenderConnectionMethod.ApiKey),
|
||||
credentials: RenderConnectionApiKeyCredentialsSchema.pick({})
|
||||
})
|
||||
]);
|
||||
|
||||
export const ValidateRenderConnectionCredentialsSchema = z.discriminatedUnion("method", [
|
||||
z.object({
|
||||
method: z.literal(RenderConnectionMethod.ApiKey).describe(AppConnections.CREATE(AppConnection.Render).method),
|
||||
credentials: RenderConnectionApiKeyCredentialsSchema.describe(
|
||||
AppConnections.CREATE(AppConnection.Render).credentials
|
||||
)
|
||||
})
|
||||
]);
|
||||
|
||||
export const CreateRenderConnectionSchema = ValidateRenderConnectionCredentialsSchema.and(
|
||||
GenericCreateAppConnectionFieldsSchema(AppConnection.Render)
|
||||
);
|
||||
|
||||
export const UpdateRenderConnectionSchema = z
|
||||
.object({
|
||||
credentials: RenderConnectionApiKeyCredentialsSchema.optional().describe(
|
||||
AppConnections.UPDATE(AppConnection.Render).credentials
|
||||
)
|
||||
})
|
||||
.and(GenericUpdateAppConnectionFieldsSchema(AppConnection.Render));
|
||||
|
||||
export const RenderConnectionListItemSchema = z.object({
|
||||
name: z.literal("Render"),
|
||||
app: z.literal(AppConnection.Render),
|
||||
methods: z.nativeEnum(RenderConnectionMethod).array()
|
||||
});
|
||||
@@ -0,0 +1,30 @@
|
||||
import { logger } from "@app/lib/logger";
|
||||
import { OrgServiceActor } from "@app/lib/types";
|
||||
|
||||
import { AppConnection } from "../app-connection-enums";
|
||||
import { listRenderServices } from "./render-connection-fns";
|
||||
import { TRenderConnection } from "./render-connection-types";
|
||||
|
||||
type TGetAppConnectionFunc = (
|
||||
app: AppConnection,
|
||||
connectionId: string,
|
||||
actor: OrgServiceActor
|
||||
) => Promise<TRenderConnection>;
|
||||
|
||||
export const renderConnectionService = (getAppConnection: TGetAppConnectionFunc) => {
|
||||
const listServices = async (connectionId: string, actor: OrgServiceActor) => {
|
||||
const appConnection = await getAppConnection(AppConnection.Render, connectionId, actor);
|
||||
try {
|
||||
const services = await listRenderServices(appConnection);
|
||||
|
||||
return services;
|
||||
} catch (error) {
|
||||
logger.error(error, "Failed to list services for Render connection");
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
listServices
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,35 @@
|
||||
import z from "zod";
|
||||
|
||||
import { DiscriminativePick } from "@app/lib/types";
|
||||
|
||||
import { AppConnection } from "../app-connection-enums";
|
||||
import {
|
||||
CreateRenderConnectionSchema,
|
||||
RenderConnectionSchema,
|
||||
ValidateRenderConnectionCredentialsSchema
|
||||
} from "./render-connection-schema";
|
||||
|
||||
export type TRenderConnection = z.infer<typeof RenderConnectionSchema>;
|
||||
|
||||
export type TRenderConnectionInput = z.infer<typeof CreateRenderConnectionSchema> & {
|
||||
app: AppConnection.Render;
|
||||
};
|
||||
|
||||
export type TValidateRenderConnectionCredentialsSchema = typeof ValidateRenderConnectionCredentialsSchema;
|
||||
|
||||
export type TRenderConnectionConfig = DiscriminativePick<TRenderConnectionInput, "method" | "app" | "credentials"> & {
|
||||
orgId: string;
|
||||
};
|
||||
|
||||
export type TRenderService = {
|
||||
name: string;
|
||||
id: string;
|
||||
};
|
||||
|
||||
export type TRawRenderService = {
|
||||
cursor: string;
|
||||
service: {
|
||||
id: string;
|
||||
name: string;
|
||||
};
|
||||
};
|
||||
4
backend/src/services/secret-sync/render/index.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export * from "./render-sync-constants";
|
||||
export * from "./render-sync-fns";
|
||||
export * from "./render-sync-schemas";
|
||||
export * from "./render-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 RENDER_SYNC_LIST_OPTION: TSecretSyncListItem = {
|
||||
name: "Render",
|
||||
destination: SecretSync.Render,
|
||||
connection: AppConnection.Render,
|
||||
canImportSecrets: true
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
export enum RenderSyncScope {
|
||||
Service = "service"
|
||||
}
|
||||
|
||||
export enum RenderSyncType {
|
||||
Env = "env",
|
||||
File = "file"
|
||||
}
|
||||
134
backend/src/services/secret-sync/render/render-sync-fns.ts
Normal file
@@ -0,0 +1,134 @@
|
||||
/* eslint-disable no-await-in-loop */
|
||||
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 { TRenderSecret, TRenderSyncWithCredentials } from "./render-sync-types";
|
||||
|
||||
const getRenderEnvironmentSecrets = async (secretSync: TRenderSyncWithCredentials) => {
|
||||
const {
|
||||
destinationConfig,
|
||||
connection: {
|
||||
credentials: { apiKey }
|
||||
}
|
||||
} = secretSync;
|
||||
|
||||
const baseUrl = `${IntegrationUrls.RENDER_API_URL}/v1/services/${destinationConfig.serviceId}/env-vars`;
|
||||
const allSecrets: TRenderSecret[] = [];
|
||||
let cursor: string | undefined;
|
||||
|
||||
do {
|
||||
const url = cursor ? `${baseUrl}?cursor=${cursor}` : baseUrl;
|
||||
const { data } = await request.get<
|
||||
{
|
||||
envVar: {
|
||||
key: string;
|
||||
value: string;
|
||||
};
|
||||
cursor: string;
|
||||
}[]
|
||||
>(url, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${apiKey}`,
|
||||
Accept: "application/json"
|
||||
}
|
||||
});
|
||||
|
||||
const secrets = data.map((item) => ({
|
||||
key: item.envVar.key,
|
||||
value: item.envVar.value
|
||||
}));
|
||||
|
||||
allSecrets.push(...secrets);
|
||||
|
||||
cursor = data[data.length - 1]?.cursor;
|
||||
} while (cursor);
|
||||
|
||||
return allSecrets;
|
||||
};
|
||||
|
||||
const putEnvironmentSecret = async (secretSync: TRenderSyncWithCredentials, secretMap: TSecretMap, key: string) => {
|
||||
const {
|
||||
destinationConfig,
|
||||
connection: {
|
||||
credentials: { apiKey }
|
||||
}
|
||||
} = secretSync;
|
||||
|
||||
await request.put(
|
||||
`${IntegrationUrls.RENDER_API_URL}/v1/services/${destinationConfig.serviceId}/env-vars/${key}`,
|
||||
{
|
||||
key,
|
||||
value: secretMap[key].value
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${apiKey}`,
|
||||
Accept: "application/json"
|
||||
}
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
const deleteEnvironmentSecret = async (secretSync: TRenderSyncWithCredentials, secret: TRenderSecret) => {
|
||||
const {
|
||||
destinationConfig,
|
||||
connection: {
|
||||
credentials: { apiKey }
|
||||
}
|
||||
} = secretSync;
|
||||
|
||||
await request.delete(
|
||||
`${IntegrationUrls.RENDER_API_URL}/v1/services/${destinationConfig.serviceId}/env-vars/${secret.key}`,
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${apiKey}`,
|
||||
Accept: "application/json"
|
||||
}
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
const sleep = async () =>
|
||||
new Promise((resolve) => {
|
||||
setTimeout(resolve, 500);
|
||||
});
|
||||
|
||||
export const RenderSyncFns = {
|
||||
syncSecrets: async (secretSync: TRenderSyncWithCredentials, secretMap: TSecretMap) => {
|
||||
const renderSecrets = await getRenderEnvironmentSecrets(secretSync);
|
||||
for await (const key of Object.keys(secretMap)) {
|
||||
await putEnvironmentSecret(secretSync, secretMap, key);
|
||||
await sleep();
|
||||
}
|
||||
|
||||
if (secretSync.syncOptions.disableSecretDeletion) return;
|
||||
|
||||
for await (const renderSecret of renderSecrets) {
|
||||
if (!matchesSchema(renderSecret.key, secretSync.environment?.slug || "", secretSync.syncOptions.keySchema))
|
||||
// eslint-disable-next-line no-continue
|
||||
continue;
|
||||
|
||||
if (!secretMap[renderSecret.key]) {
|
||||
await deleteEnvironmentSecret(secretSync, renderSecret);
|
||||
await sleep();
|
||||
}
|
||||
}
|
||||
},
|
||||
getSecrets: async (secretSync: TRenderSyncWithCredentials): Promise<TSecretMap> => {
|
||||
const renderSecrets = await getRenderEnvironmentSecrets(secretSync);
|
||||
return Object.fromEntries(renderSecrets.map((secret) => [secret.key, { value: secret.value ?? "" }]));
|
||||
},
|
||||
|
||||
removeSecrets: async (secretSync: TRenderSyncWithCredentials, secretMap: TSecretMap) => {
|
||||
const encryptedSecrets = await getRenderEnvironmentSecrets(secretSync);
|
||||
|
||||
for await (const encryptedSecret of encryptedSecrets) {
|
||||
if (encryptedSecret.key in secretMap) {
|
||||
await deleteEnvironmentSecret(secretSync, encryptedSecret);
|
||||
await sleep();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,49 @@
|
||||
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";
|
||||
|
||||
import { RenderSyncScope, RenderSyncType } from "./render-sync-enums";
|
||||
|
||||
const RenderSyncDestinationConfigSchema = z.discriminatedUnion("scope", [
|
||||
z.object({
|
||||
scope: z.literal(RenderSyncScope.Service).describe(SecretSyncs.DESTINATION_CONFIG.RENDER.scope),
|
||||
serviceId: z.string().min(1, "Service ID is required").describe(SecretSyncs.DESTINATION_CONFIG.RENDER.serviceId),
|
||||
type: z.nativeEnum(RenderSyncType).describe(SecretSyncs.DESTINATION_CONFIG.RENDER.type)
|
||||
})
|
||||
]);
|
||||
|
||||
const RenderSyncOptionsConfig: TSyncOptionsConfig = { canImportSecrets: true };
|
||||
|
||||
export const RenderSyncSchema = BaseSecretSyncSchema(SecretSync.Render, RenderSyncOptionsConfig).extend({
|
||||
destination: z.literal(SecretSync.Render),
|
||||
destinationConfig: RenderSyncDestinationConfigSchema
|
||||
});
|
||||
|
||||
export const CreateRenderSyncSchema = GenericCreateSecretSyncFieldsSchema(
|
||||
SecretSync.Render,
|
||||
RenderSyncOptionsConfig
|
||||
).extend({
|
||||
destinationConfig: RenderSyncDestinationConfigSchema
|
||||
});
|
||||
|
||||
export const UpdateRenderSyncSchema = GenericUpdateSecretSyncFieldsSchema(
|
||||
SecretSync.Render,
|
||||
RenderSyncOptionsConfig
|
||||
).extend({
|
||||
destinationConfig: RenderSyncDestinationConfigSchema.optional()
|
||||
});
|
||||
|
||||
export const RenderSyncListItemSchema = z.object({
|
||||
name: z.literal("Render"),
|
||||
connection: z.literal(AppConnection.Render),
|
||||
destination: z.literal(SecretSync.Render),
|
||||
canImportSecrets: z.literal(true)
|
||||
});
|
||||
20
backend/src/services/secret-sync/render/render-sync-types.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import z from "zod";
|
||||
|
||||
import { TRenderConnection } from "@app/services/app-connection/render/render-connection-types";
|
||||
|
||||
import { CreateRenderSyncSchema, RenderSyncListItemSchema, RenderSyncSchema } from "./render-sync-schemas";
|
||||
|
||||
export type TRenderSyncListItem = z.infer<typeof RenderSyncListItemSchema>;
|
||||
|
||||
export type TRenderSync = z.infer<typeof RenderSyncSchema>;
|
||||
|
||||
export type TRenderSyncInput = z.infer<typeof CreateRenderSyncSchema>;
|
||||
|
||||
export type TRenderSyncWithCredentials = TRenderSync & {
|
||||
connection: TRenderConnection;
|
||||
};
|
||||
|
||||
export type TRenderSecret = {
|
||||
key: string;
|
||||
value: string;
|
||||
};
|
||||
@@ -16,6 +16,7 @@ export enum SecretSync {
|
||||
TeamCity = "teamcity",
|
||||
OCIVault = "oci-vault",
|
||||
OnePass = "1password",
|
||||
Render = "render",
|
||||
Flyio = "flyio"
|
||||
}
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ import { GcpSyncFns } from "./gcp/gcp-sync-fns";
|
||||
import { HC_VAULT_SYNC_LIST_OPTION, HCVaultSyncFns } from "./hc-vault";
|
||||
import { HUMANITEC_SYNC_LIST_OPTION } from "./humanitec";
|
||||
import { HumanitecSyncFns } from "./humanitec/humanitec-sync-fns";
|
||||
import { RENDER_SYNC_LIST_OPTION, RenderSyncFns } from "./render";
|
||||
import { SECRET_SYNC_PLAN_MAP } from "./secret-sync-maps";
|
||||
import { TEAMCITY_SYNC_LIST_OPTION, TeamCitySyncFns } from "./teamcity";
|
||||
import { TERRAFORM_CLOUD_SYNC_LIST_OPTION, TerraformCloudSyncFns } from "./terraform-cloud";
|
||||
@@ -59,6 +60,7 @@ const SECRET_SYNC_LIST_OPTIONS: Record<SecretSync, TSecretSyncListItem> = {
|
||||
[SecretSync.TeamCity]: TEAMCITY_SYNC_LIST_OPTION,
|
||||
[SecretSync.OCIVault]: OCI_VAULT_SYNC_LIST_OPTION,
|
||||
[SecretSync.OnePass]: ONEPASS_SYNC_LIST_OPTION,
|
||||
[SecretSync.Render]: RENDER_SYNC_LIST_OPTION,
|
||||
[SecretSync.Flyio]: FLYIO_SYNC_LIST_OPTION
|
||||
};
|
||||
|
||||
@@ -217,6 +219,8 @@ export const SecretSyncFns = {
|
||||
return OCIVaultSyncFns.syncSecrets(secretSync, schemaSecretMap);
|
||||
case SecretSync.OnePass:
|
||||
return OnePassSyncFns.syncSecrets(secretSync, schemaSecretMap);
|
||||
case SecretSync.Render:
|
||||
return RenderSyncFns.syncSecrets(secretSync, schemaSecretMap);
|
||||
case SecretSync.Flyio:
|
||||
return FlyioSyncFns.syncSecrets(secretSync, schemaSecretMap);
|
||||
default:
|
||||
@@ -296,6 +300,9 @@ export const SecretSyncFns = {
|
||||
case SecretSync.OnePass:
|
||||
secretMap = await OnePassSyncFns.getSecrets(secretSync);
|
||||
break;
|
||||
case SecretSync.Render:
|
||||
secretMap = await RenderSyncFns.getSecrets(secretSync);
|
||||
break;
|
||||
case SecretSync.Flyio:
|
||||
secretMap = await FlyioSyncFns.getSecrets(secretSync);
|
||||
break;
|
||||
@@ -366,6 +373,8 @@ export const SecretSyncFns = {
|
||||
return OCIVaultSyncFns.removeSecrets(secretSync, schemaSecretMap);
|
||||
case SecretSync.OnePass:
|
||||
return OnePassSyncFns.removeSecrets(secretSync, schemaSecretMap);
|
||||
case SecretSync.Render:
|
||||
return RenderSyncFns.removeSecrets(secretSync, schemaSecretMap);
|
||||
case SecretSync.Flyio:
|
||||
return FlyioSyncFns.removeSecrets(secretSync, schemaSecretMap);
|
||||
default:
|
||||
|
||||
@@ -19,6 +19,7 @@ export const SECRET_SYNC_NAME_MAP: Record<SecretSync, string> = {
|
||||
[SecretSync.TeamCity]: "TeamCity",
|
||||
[SecretSync.OCIVault]: "OCI Vault",
|
||||
[SecretSync.OnePass]: "1Password",
|
||||
[SecretSync.Render]: "Render",
|
||||
[SecretSync.Flyio]: "Fly.io"
|
||||
};
|
||||
|
||||
@@ -40,6 +41,7 @@ export const SECRET_SYNC_CONNECTION_MAP: Record<SecretSync, AppConnection> = {
|
||||
[SecretSync.TeamCity]: AppConnection.TeamCity,
|
||||
[SecretSync.OCIVault]: AppConnection.OCI,
|
||||
[SecretSync.OnePass]: AppConnection.OnePass,
|
||||
[SecretSync.Render]: AppConnection.Render,
|
||||
[SecretSync.Flyio]: AppConnection.Flyio
|
||||
};
|
||||
|
||||
@@ -61,5 +63,6 @@ export const SECRET_SYNC_PLAN_MAP: Record<SecretSync, SecretSyncPlanType> = {
|
||||
[SecretSync.TeamCity]: SecretSyncPlanType.Regular,
|
||||
[SecretSync.OCIVault]: SecretSyncPlanType.Enterprise,
|
||||
[SecretSync.OnePass]: SecretSyncPlanType.Regular,
|
||||
[SecretSync.Render]: SecretSyncPlanType.Regular,
|
||||
[SecretSync.Flyio]: SecretSyncPlanType.Regular
|
||||
};
|
||||
|
||||
@@ -86,6 +86,12 @@ import {
|
||||
THumanitecSyncListItem,
|
||||
THumanitecSyncWithCredentials
|
||||
} from "./humanitec";
|
||||
import {
|
||||
TRenderSync,
|
||||
TRenderSyncInput,
|
||||
TRenderSyncListItem,
|
||||
TRenderSyncWithCredentials
|
||||
} from "./render/render-sync-types";
|
||||
import {
|
||||
TTeamCitySync,
|
||||
TTeamCitySyncInput,
|
||||
@@ -118,6 +124,7 @@ export type TSecretSync =
|
||||
| TTeamCitySync
|
||||
| TOCIVaultSync
|
||||
| TOnePassSync
|
||||
| TRenderSync
|
||||
| TFlyioSync;
|
||||
|
||||
export type TSecretSyncWithCredentials =
|
||||
@@ -138,6 +145,7 @@ export type TSecretSyncWithCredentials =
|
||||
| TTeamCitySyncWithCredentials
|
||||
| TOCIVaultSyncWithCredentials
|
||||
| TOnePassSyncWithCredentials
|
||||
| TRenderSyncWithCredentials
|
||||
| TFlyioSyncWithCredentials;
|
||||
|
||||
export type TSecretSyncInput =
|
||||
@@ -158,6 +166,7 @@ export type TSecretSyncInput =
|
||||
| TTeamCitySyncInput
|
||||
| TOCIVaultSyncInput
|
||||
| TOnePassSyncInput
|
||||
| TRenderSyncInput
|
||||
| TFlyioSyncInput;
|
||||
|
||||
export type TSecretSyncListItem =
|
||||
@@ -178,6 +187,7 @@ export type TSecretSyncListItem =
|
||||
| TTeamCitySyncListItem
|
||||
| TOCIVaultSyncListItem
|
||||
| TOnePassSyncListItem
|
||||
| TRenderSyncListItem
|
||||
| TFlyioSyncListItem;
|
||||
|
||||
export type TSyncOptionsConfig = {
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
---
|
||||
title: "Available"
|
||||
openapi: "GET /api/v1/app-connections/render/available"
|
||||
---
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: "Create"
|
||||
openapi: "POST /api/v1/app-connections/render"
|
||||
---
|
||||
|
||||
<Note>
|
||||
Check out the configuration docs for [Render
|
||||
Connections](/integrations/app-connections/render) to learn how to obtain the
|
||||
required credentials.
|
||||
</Note>
|
||||
@@ -0,0 +1,4 @@
|
||||
---
|
||||
title: "Delete"
|
||||
openapi: "DELETE /api/v1/app-connections/render/{connectionId}"
|
||||
---
|
||||
@@ -0,0 +1,4 @@
|
||||
---
|
||||
title: "Get by ID"
|
||||
openapi: "GET /api/v1/app-connections/render/{connectionId}"
|
||||
---
|
||||
@@ -0,0 +1,4 @@
|
||||
---
|
||||
title: "Get by Name"
|
||||
openapi: "GET /api/v1/app-connections/render/connection-name/{connectionName}"
|
||||
---
|
||||
@@ -0,0 +1,4 @@
|
||||
---
|
||||
title: "List"
|
||||
openapi: "GET /api/v1/app-connections/render"
|
||||
---
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: "Update"
|
||||
openapi: "PATCH /api/v1/app-connections/render/{connectionId}"
|
||||
---
|
||||
|
||||
<Note>
|
||||
Check out the configuration docs for [Render
|
||||
Connections](/integrations/app-connections/render) to learn how to obtain the
|
||||
required credentials.
|
||||
</Note>
|
||||
@@ -0,0 +1,4 @@
|
||||
---
|
||||
title: "Create"
|
||||
openapi: "POST /api/v1/secret-syncs/render"
|
||||
---
|
||||
@@ -0,0 +1,4 @@
|
||||
---
|
||||
title: "Delete"
|
||||
openapi: "DELETE /api/v1/secret-syncs/render/{syncId}"
|
||||
---
|
||||
@@ -0,0 +1,4 @@
|
||||
---
|
||||
title: "Get by ID"
|
||||
openapi: "GET /api/v1/secret-syncs/render/{syncId}"
|
||||
---
|
||||
@@ -0,0 +1,4 @@
|
||||
---
|
||||
title: "Get by Name"
|
||||
openapi: "GET /api/v1/secret-syncs/render/sync-name/{syncName}"
|
||||
---
|
||||
@@ -0,0 +1,4 @@
|
||||
---
|
||||
title: "Import Secrets"
|
||||
openapi: "POST /api/v1/secret-syncs/render/{syncId}/import-secrets"
|
||||
---
|
||||
@@ -0,0 +1,4 @@
|
||||
---
|
||||
title: "List"
|
||||
openapi: "GET /api/v1/secret-syncs/render"
|
||||
---
|
||||
@@ -0,0 +1,4 @@
|
||||
---
|
||||
title: "Remove Secrets"
|
||||
openapi: "POST /api/v1/secret-syncs/render/{syncId}/remove-secrets"
|
||||
---
|
||||
@@ -0,0 +1,4 @@
|
||||
---
|
||||
title: "Sync Secrets"
|
||||
openapi: "POST /api/v1/secret-syncs/render/{syncId}/sync-secrets"
|
||||
---
|
||||
@@ -0,0 +1,4 @@
|
||||
---
|
||||
title: "Update"
|
||||
openapi: "PATCH /api/v1/secret-syncs/render/{syncId}"
|
||||
---
|
||||
BIN
docs/images/app-connections/render/render-account-settings.png
Normal file
|
After Width: | Height: | Size: 473 KiB |
|
After Width: | Height: | Size: 969 KiB |
|
After Width: | Height: | Size: 534 KiB |
|
After Width: | Height: | Size: 703 KiB |
BIN
docs/images/app-connections/render/render-create-api-key.png
Normal file
|
After Width: | Height: | Size: 338 KiB |
BIN
docs/images/app-connections/render/render-name-api-key.png
Normal file
|
After Width: | Height: | Size: 341 KiB |
BIN
docs/images/secret-syncs/render/render-sync-created.png
Normal file
|
After Width: | Height: | Size: 994 KiB |
BIN
docs/images/secret-syncs/render/render-sync-destination.png
Normal file
|
After Width: | Height: | Size: 627 KiB |
BIN
docs/images/secret-syncs/render/render-sync-details.png
Normal file
|
After Width: | Height: | Size: 622 KiB |
BIN
docs/images/secret-syncs/render/render-sync-options.png
Normal file
|
After Width: | Height: | Size: 661 KiB |
BIN
docs/images/secret-syncs/render/render-sync-review.png
Normal file
|
After Width: | Height: | Size: 648 KiB |
BIN
docs/images/secret-syncs/render/render-sync-source.png
Normal file
|
After Width: | Height: | Size: 612 KiB |
BIN
docs/images/secret-syncs/render/select-render-option.png
Normal file
|
After Width: | Height: | Size: 704 KiB |
55
docs/integrations/app-connections/render.mdx
Normal file
@@ -0,0 +1,55 @@
|
||||
---
|
||||
title: "Render Connection"
|
||||
description: "Learn how to configure a Render Connection for Infisical."
|
||||
---
|
||||
|
||||
Infisical supports connecting to Render using API keys for secure access to your Render services.
|
||||
|
||||
## Configure API Key for Infisical
|
||||
|
||||
<Steps>
|
||||
<Step title="Access Account Settings">
|
||||
Navigate to your Render dashboard and click on **Account Settings** in the
|
||||
top right corner. 
|
||||
</Step>
|
||||
<Step title="Generate API Key">
|
||||
In the Account Settings page, scroll down to the **API Keys** section and
|
||||
click **Create API Key**. 
|
||||
</Step>
|
||||
<Step title="Name Your API Key">
|
||||
Enter a descriptive name for your API key (e.g., "production")
|
||||
and click **Create API Key**. 
|
||||
</Step>
|
||||
<Step title="Save Your API Key">
|
||||
After creation, you'll be shown your API key. Make sure to copy and securely
|
||||
store this key as it will not be shown again.
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
## Setup Render Connection in Infisical
|
||||
|
||||
<Steps>
|
||||
<Step title="Navigate to App Connections">
|
||||
Navigate to the **App Connections** tab on the **Organization Settings**
|
||||
page. 
|
||||
</Step>
|
||||
<Step title="Add Connection">
|
||||
Select the **Render Connection** option from the connection options modal.
|
||||

|
||||
</Step>
|
||||
<Step title="Input API Key">
|
||||
Enter your Render API key in the provided field and click **Connect to
|
||||
Render** to establish the connection. 
|
||||
</Step>
|
||||
<Step title="Connection Created">
|
||||
Your **Render Connection** is now available for use in your Infisical
|
||||
projects. 
|
||||
</Step>
|
||||
</Steps>
|
||||
@@ -3,30 +3,7 @@ title: "Render"
|
||||
description: "How to sync secrets from Infisical to Render"
|
||||
---
|
||||
|
||||
Prerequisites:
|
||||
|
||||
- Set up and add envars to [Infisical Cloud](https://app.infisical.com)
|
||||
|
||||
<Steps>
|
||||
<Step title="Authorize Infisical for Render">
|
||||
Obtain a Render API Key in your Render Account Settings > API Keys.
|
||||
|
||||

|
||||

|
||||
|
||||
Navigate to your project's integrations tab in Infisical.
|
||||
|
||||

|
||||
|
||||
Press on the Render tile and input your Render API Key to grant Infisical access to your Render account.
|
||||
|
||||

|
||||
|
||||
</Step>
|
||||
<Step title="Start integration">
|
||||
Select which Infisical environment secrets you want to sync to which Render service and press create integration to start syncing secrets to Render.
|
||||
|
||||

|
||||

|
||||
</Step>
|
||||
</Steps>
|
||||
<Note>
|
||||
The Render Native Integration will be deprecated in 2026. Please migrate to
|
||||
our new [Render Sync](../secret-syncs/render).
|
||||
</Note>
|
||||
|
||||
135
docs/integrations/secret-syncs/render.mdx
Normal file
@@ -0,0 +1,135 @@
|
||||
---
|
||||
title: "Render Sync"
|
||||
description: "Learn how to configure a Render Sync for Infisical."
|
||||
---
|
||||
|
||||
**Prerequisites:**
|
||||
|
||||
- Set up and add secrets to [Infisical Cloud](https://app.infisical.com)
|
||||
- Create a [Render Connection](/integrations/app-connections/render)
|
||||
|
||||
<Tabs>
|
||||
<Tab title="Infisical UI">
|
||||
1. Navigate to **Project** > **Integrations** and select the **Secret Syncs** tab. Click on the **Add Sync** button.
|
||||

|
||||
|
||||
2. Select the **Render** option.
|
||||

|
||||
|
||||
3. 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>
|
||||
|
||||
4. Configure the **Destination** to where secrets should be deployed, then click **Next**.
|
||||

|
||||
|
||||
- **Render Connection**: The Render Connection to authenticate with.
|
||||
- **Scope**: Select **Service**.
|
||||
- **Service**: Choose the Render service you want to sync secrets to.
|
||||
|
||||
5. 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 Render service before syncing, prioritizing values from Infisical over Render when keys conflict.
|
||||
- **Import Secrets (Prioritize Render)**: Imports secrets from the Render service before syncing, prioritizing values from Render 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.
|
||||
- **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.
|
||||
|
||||
6. Configure the **Details** of your Render Sync, then click **Next**.
|
||||

|
||||
|
||||
- **Name**: The name of your sync. Must be slug-friendly.
|
||||
- **Description**: An optional description for your sync.
|
||||
|
||||
7. Review your Render Sync configuration, then click **Create Sync**.
|
||||

|
||||
|
||||
8. If enabled, your Render Sync will begin syncing your secrets to the destination endpoint.
|
||||

|
||||
|
||||
</Tab>
|
||||
<Tab title="API">
|
||||
To create a **Render Sync**, make an API request to the [Create Render Sync](/api-reference/endpoints/secret-syncs/render/create) API endpoint.
|
||||
|
||||
### Sample request
|
||||
|
||||
```bash Request
|
||||
curl --request POST \
|
||||
--url https://app.infisical.com/api/v1/secret-syncs/render \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data '{
|
||||
"name": "my-render-sync",
|
||||
"projectId": "your-project-id",
|
||||
"description": "an example sync",
|
||||
"connectionId": "your-render-connection-id",
|
||||
"environment": "production",
|
||||
"secretPath": "/my-secrets",
|
||||
"isEnabled": true,
|
||||
"syncOptions": {
|
||||
"initialSyncBehavior": "overwrite-destination"
|
||||
},
|
||||
"destinationConfig": {
|
||||
"scope": "service",
|
||||
"serviceId": "your-render-service-id",
|
||||
"type": "env"
|
||||
}
|
||||
}'
|
||||
```
|
||||
|
||||
### Sample response
|
||||
|
||||
```bash Response
|
||||
{
|
||||
"secretSync": {
|
||||
"id": "your-sync-id",
|
||||
"name": "my-render-sync",
|
||||
"description": "an example sync",
|
||||
"isEnabled": true,
|
||||
"version": 1,
|
||||
"folderId": "your-folder-id",
|
||||
"connectionId": "your-render-connection-id",
|
||||
"createdAt": "2024-05-01T12:00:00Z",
|
||||
"updatedAt": "2024-05-01T12:00:00Z",
|
||||
"syncStatus": "succeeded",
|
||||
"lastSyncJobId": "123",
|
||||
"lastSyncMessage": null,
|
||||
"lastSyncedAt": "2024-05-01T12:00:00Z",
|
||||
"syncOptions": {
|
||||
"initialSyncBehavior": "overwrite-destination"
|
||||
},
|
||||
"projectId": "your-project-id",
|
||||
"connection": {
|
||||
"app": "render",
|
||||
"name": "my-render-connection",
|
||||
"id": "your-render-connection-id"
|
||||
},
|
||||
"environment": {
|
||||
"slug": "production",
|
||||
"name": "Production",
|
||||
"id": "your-env-id"
|
||||
},
|
||||
"folder": {
|
||||
"id": "your-folder-id",
|
||||
"path": "/my-secrets"
|
||||
},
|
||||
"destination": "render",
|
||||
"destinationConfig": {
|
||||
"scope": "service",
|
||||
"serviceId": "your-render-service-id",
|
||||
"type": "env"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
</Tab>
|
||||
</Tabs>
|
||||
@@ -516,6 +516,7 @@
|
||||
"integrations/app-connections/oci",
|
||||
"integrations/app-connections/oracledb",
|
||||
"integrations/app-connections/postgres",
|
||||
"integrations/app-connections/render",
|
||||
"integrations/app-connections/teamcity",
|
||||
"integrations/app-connections/terraform-cloud",
|
||||
"integrations/app-connections/vercel",
|
||||
@@ -545,6 +546,7 @@
|
||||
"integrations/secret-syncs/hashicorp-vault",
|
||||
"integrations/secret-syncs/humanitec",
|
||||
"integrations/secret-syncs/oci-vault",
|
||||
"integrations/secret-syncs/render",
|
||||
"integrations/secret-syncs/teamcity",
|
||||
"integrations/secret-syncs/terraform-cloud",
|
||||
"integrations/secret-syncs/vercel",
|
||||
@@ -1409,6 +1411,18 @@
|
||||
"api-reference/endpoints/app-connections/postgres/delete"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Render",
|
||||
"pages": [
|
||||
"api-reference/endpoints/app-connections/render/list",
|
||||
"api-reference/endpoints/app-connections/render/available",
|
||||
"api-reference/endpoints/app-connections/render/get-by-id",
|
||||
"api-reference/endpoints/app-connections/render/get-by-name",
|
||||
"api-reference/endpoints/app-connections/render/create",
|
||||
"api-reference/endpoints/app-connections/render/update",
|
||||
"api-reference/endpoints/app-connections/render/delete"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "TeamCity",
|
||||
"pages": [
|
||||
@@ -1655,6 +1669,20 @@
|
||||
"api-reference/endpoints/secret-syncs/oci-vault/remove-secrets"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Render",
|
||||
"pages": [
|
||||
"api-reference/endpoints/secret-syncs/render/list",
|
||||
"api-reference/endpoints/secret-syncs/render/get-by-id",
|
||||
"api-reference/endpoints/secret-syncs/render/get-by-name",
|
||||
"api-reference/endpoints/secret-syncs/render/create",
|
||||
"api-reference/endpoints/secret-syncs/render/update",
|
||||
"api-reference/endpoints/secret-syncs/render/delete",
|
||||
"api-reference/endpoints/secret-syncs/render/sync-secrets",
|
||||
"api-reference/endpoints/secret-syncs/render/import-secrets",
|
||||
"api-reference/endpoints/secret-syncs/render/remove-secrets"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "TeamCity",
|
||||
"pages": [
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
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, Select, SelectItem } from "@app/components/v2";
|
||||
import { RENDER_SYNC_SCOPES } from "@app/helpers/secretSyncs";
|
||||
import {
|
||||
TRenderService,
|
||||
useRenderConnectionListServices
|
||||
} from "@app/hooks/api/appConnections/render";
|
||||
import { SecretSync } from "@app/hooks/api/secretSyncs";
|
||||
import { RenderSyncScope, RenderSyncType } from "@app/hooks/api/secretSyncs/render-sync";
|
||||
|
||||
import { TSecretSyncForm } from "../schemas";
|
||||
|
||||
export const RenderSyncFields = () => {
|
||||
const { control, setValue } = useFormContext<
|
||||
TSecretSyncForm & { destination: SecretSync.Render }
|
||||
>();
|
||||
|
||||
const connectionId = useWatch({ name: "connection.id", control });
|
||||
|
||||
const { data: services = [], isPending: isServicesPending } = useRenderConnectionListServices(
|
||||
connectionId,
|
||||
{
|
||||
enabled: Boolean(connectionId)
|
||||
}
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
<SecretSyncConnectionField
|
||||
onChange={() => {
|
||||
setValue("destinationConfig.serviceId", "");
|
||||
setValue("destinationConfig.type", RenderSyncType.Env);
|
||||
setValue("destinationConfig.scope", RenderSyncScope.Service);
|
||||
}}
|
||||
/>
|
||||
<Controller
|
||||
name="destinationConfig.scope"
|
||||
control={control}
|
||||
defaultValue={RenderSyncScope.Service}
|
||||
render={({ field: { value, onChange }, fieldState: { error } }) => (
|
||||
<FormControl
|
||||
errorText={error?.message}
|
||||
isError={Boolean(error?.message)}
|
||||
label="Scope"
|
||||
tooltipClassName="max-w-lg py-3"
|
||||
tooltipText={
|
||||
<div className="flex flex-col gap-3">
|
||||
<p>
|
||||
Specify how Infisical should manage secrets from Render. The following options are
|
||||
available:
|
||||
</p>
|
||||
<ul className="flex list-disc flex-col gap-3 pl-4">
|
||||
{Object.values(RENDER_SYNC_SCOPES).map(({ name, description }) => {
|
||||
return (
|
||||
<li key={name}>
|
||||
<p className="text-mineshaft-300">
|
||||
<span className="font-medium text-bunker-200">{name}</span>: {description}
|
||||
</p>
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<Select
|
||||
value={value}
|
||||
onValueChange={(val) => onChange(val)}
|
||||
className="w-full border border-mineshaft-500 capitalize"
|
||||
position="popper"
|
||||
placeholder="Select a scope..."
|
||||
dropdownContainerClassName="max-w-none"
|
||||
>
|
||||
{Object.values(RenderSyncScope).map((scope) => (
|
||||
<SelectItem className="capitalize" value={scope} key={scope}>
|
||||
{scope.replace("-", " ")}
|
||||
</SelectItem>
|
||||
))}
|
||||
</Select>
|
||||
</FormControl>
|
||||
)}
|
||||
/>
|
||||
<Controller
|
||||
name="destinationConfig.serviceId"
|
||||
control={control}
|
||||
render={({ field: { value, onChange }, fieldState: { error } }) => (
|
||||
<FormControl errorText={error?.message} isError={Boolean(error?.message)} label="Service">
|
||||
<FilterableSelect
|
||||
isLoading={isServicesPending && Boolean(connectionId)}
|
||||
isDisabled={!connectionId}
|
||||
value={services ? (services.find((service) => service.id === value) ?? []) : []}
|
||||
onChange={(option) => {
|
||||
onChange((option as SingleValue<TRenderService>)?.id ?? null);
|
||||
setValue(
|
||||
"destinationConfig.serviceName",
|
||||
(option as SingleValue<TRenderService>)?.name ?? ""
|
||||
);
|
||||
}}
|
||||
options={services}
|
||||
placeholder="Select a service..."
|
||||
getOptionLabel={(option) => option.name}
|
||||
getOptionValue={(option) => option.id.toString()}
|
||||
/>
|
||||
</FormControl>
|
||||
)}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
};
|
||||
@@ -17,6 +17,7 @@ import { GitHubSyncFields } from "./GitHubSyncFields";
|
||||
import { HCVaultSyncFields } from "./HCVaultSyncFields";
|
||||
import { HumanitecSyncFields } from "./HumanitecSyncFields";
|
||||
import { OCIVaultSyncFields } from "./OCIVaultSyncFields";
|
||||
import { RenderSyncFields } from "./RenderSyncFields";
|
||||
import { TeamCitySyncFields } from "./TeamCitySyncFields";
|
||||
import { TerraformCloudSyncFields } from "./TerraformCloudSyncFields";
|
||||
import { VercelSyncFields } from "./VercelSyncFields";
|
||||
@@ -62,6 +63,8 @@ export const SecretSyncDestinationFields = () => {
|
||||
return <OCIVaultSyncFields />;
|
||||
case SecretSync.OnePass:
|
||||
return <OnePassSyncFields />;
|
||||
case SecretSync.Render:
|
||||
return <RenderSyncFields />;
|
||||
case SecretSync.Flyio:
|
||||
return <FlyioSyncFields />;
|
||||
default:
|
||||
|
||||
@@ -52,6 +52,7 @@ export const SecretSyncOptionsFields = ({ hideInitialSync }: Props) => {
|
||||
case SecretSync.TeamCity:
|
||||
case SecretSync.OnePass:
|
||||
case SecretSync.OCIVault:
|
||||
case SecretSync.Render:
|
||||
case SecretSync.Flyio:
|
||||
AdditionalSyncOptionsFieldsComponent = null;
|
||||
break;
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
import { useFormContext } from "react-hook-form";
|
||||
|
||||
import { GenericFieldLabel } from "@app/components/secret-syncs";
|
||||
import { TSecretSyncForm } from "@app/components/secret-syncs/forms/schemas";
|
||||
import { SecretSync } from "@app/hooks/api/secretSyncs";
|
||||
|
||||
export const RenderSyncReviewFields = () => {
|
||||
const { watch } = useFormContext<TSecretSyncForm & { destination: SecretSync.Render }>();
|
||||
const serviceName = watch("destinationConfig.serviceName");
|
||||
const scope = watch("destinationConfig.scope");
|
||||
|
||||
return (
|
||||
<>
|
||||
<GenericFieldLabel label="Scope">{scope}</GenericFieldLabel>
|
||||
<GenericFieldLabel label="Service">{serviceName}</GenericFieldLabel>
|
||||
</>
|
||||
);
|
||||
};
|
||||
@@ -27,6 +27,7 @@ import { HCVaultSyncReviewFields } from "./HCVaultSyncReviewFields";
|
||||
import { HumanitecSyncReviewFields } from "./HumanitecSyncReviewFields";
|
||||
import { OCIVaultSyncReviewFields } from "./OCIVaultSyncReviewFields";
|
||||
import { OnePassSyncReviewFields } from "./OnePassSyncReviewFields";
|
||||
import { RenderSyncReviewFields } from "./RenderSyncReviewFields";
|
||||
import { TeamCitySyncReviewFields } from "./TeamCitySyncReviewFields";
|
||||
import { TerraformCloudSyncReviewFields } from "./TerraformCloudSyncReviewFields";
|
||||
import { VercelSyncReviewFields } from "./VercelSyncReviewFields";
|
||||
@@ -105,6 +106,9 @@ export const SecretSyncReviewFields = () => {
|
||||
case SecretSync.OnePass:
|
||||
DestinationFieldsComponent = <OnePassSyncReviewFields />;
|
||||
break;
|
||||
case SecretSync.Render:
|
||||
DestinationFieldsComponent = <RenderSyncReviewFields />;
|
||||
break;
|
||||
case SecretSync.Flyio:
|
||||
DestinationFieldsComponent = <FlyioSyncReviewFields />;
|
||||
break;
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
import { z } from "zod";
|
||||
|
||||
import { BaseSecretSyncSchema } from "@app/components/secret-syncs/forms/schemas/base-secret-sync-schema";
|
||||
import { SecretSync } from "@app/hooks/api/secretSyncs";
|
||||
import { RenderSyncScope, RenderSyncType } from "@app/hooks/api/secretSyncs/render-sync";
|
||||
|
||||
export const RenderSyncDestinationSchema = BaseSecretSyncSchema().merge(
|
||||
z.object({
|
||||
destination: z.literal(SecretSync.Render),
|
||||
destinationConfig: z.discriminatedUnion("scope", [
|
||||
z.object({
|
||||
scope: z.literal(RenderSyncScope.Service),
|
||||
serviceId: z.string().trim().min(1, "Service is required"),
|
||||
serviceName: z.string().trim().optional(),
|
||||
type: z.nativeEnum(RenderSyncType)
|
||||
})
|
||||
])
|
||||
})
|
||||
);
|
||||
@@ -14,6 +14,7 @@ import { GitHubSyncDestinationSchema } from "./github-sync-destination-schema";
|
||||
import { HCVaultSyncDestinationSchema } from "./hc-vault-sync-destination-schema";
|
||||
import { HumanitecSyncDestinationSchema } from "./humanitec-sync-destination-schema";
|
||||
import { OCIVaultSyncDestinationSchema } from "./oci-vault-sync-destination-schema";
|
||||
import { RenderSyncDestinationSchema } from "./render-sync-destination-schema";
|
||||
import { TeamCitySyncDestinationSchema } from "./teamcity-sync-destination-schema";
|
||||
import { TerraformCloudSyncDestinationSchema } from "./terraform-cloud-destination-schema";
|
||||
import { VercelSyncDestinationSchema } from "./vercel-sync-destination-schema";
|
||||
@@ -37,6 +38,7 @@ const SecretSyncUnionSchema = z.discriminatedUnion("destination", [
|
||||
TeamCitySyncDestinationSchema,
|
||||
OCIVaultSyncDestinationSchema,
|
||||
OnePassSyncDestinationSchema,
|
||||
RenderSyncDestinationSchema,
|
||||
FlyioSyncDestinationSchema
|
||||
]);
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ import {
|
||||
WindmillConnectionMethod
|
||||
} from "@app/hooks/api/appConnections/types";
|
||||
import { OCIConnectionMethod } from "@app/hooks/api/appConnections/types/oci-connection";
|
||||
import { RenderConnectionMethod } from "@app/hooks/api/appConnections/types/render-connection";
|
||||
|
||||
export const APP_CONNECTION_MAP: Record<
|
||||
AppConnection,
|
||||
@@ -80,6 +81,7 @@ export const APP_CONNECTION_MAP: Record<
|
||||
[AppConnection.TeamCity]: { name: "TeamCity", image: "TeamCity.png" },
|
||||
[AppConnection.OCI]: { name: "OCI", image: "Oracle.png", enterprise: true },
|
||||
[AppConnection.OnePass]: { name: "1Password", image: "1Password.png" },
|
||||
[AppConnection.Render]: { name: "Render", image: "Render.png" },
|
||||
[AppConnection.Flyio]: { name: "Fly.io", image: "Flyio.svg" }
|
||||
};
|
||||
|
||||
@@ -127,6 +129,8 @@ export const getAppConnectionMethodDetails = (method: TAppConnection["method"])
|
||||
return { name: "App Role", icon: faUser };
|
||||
case LdapConnectionMethod.SimpleBind:
|
||||
return { name: "Simple Bind", icon: faLink };
|
||||
case RenderConnectionMethod.ApiKey:
|
||||
return { name: "API Key", icon: faKey };
|
||||
default:
|
||||
throw new Error(`Unhandled App Connection Method: ${method}`);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import {
|
||||
SecretSyncImportBehavior,
|
||||
SecretSyncInitialSyncBehavior
|
||||
} from "@app/hooks/api/secretSyncs";
|
||||
import { RenderSyncScope } from "@app/hooks/api/secretSyncs/render-sync";
|
||||
import { GcpSyncScope } from "@app/hooks/api/secretSyncs/types/gcp-sync";
|
||||
import { HumanitecSyncScope } from "@app/hooks/api/secretSyncs/types/humanitec-sync";
|
||||
|
||||
@@ -61,6 +62,10 @@ export const SECRET_SYNC_MAP: Record<SecretSync, { name: string; image: string }
|
||||
name: "1Password",
|
||||
image: "1Password.png"
|
||||
},
|
||||
[SecretSync.Render]: {
|
||||
name: "Render",
|
||||
image: "Render.png"
|
||||
},
|
||||
[SecretSync.Flyio]: {
|
||||
name: "Fly.io",
|
||||
image: "Flyio.svg"
|
||||
@@ -85,6 +90,7 @@ export const SECRET_SYNC_CONNECTION_MAP: Record<SecretSync, AppConnection> = {
|
||||
[SecretSync.TeamCity]: AppConnection.TeamCity,
|
||||
[SecretSync.OCIVault]: AppConnection.OCI,
|
||||
[SecretSync.OnePass]: AppConnection.OnePass,
|
||||
[SecretSync.Render]: AppConnection.Render,
|
||||
[SecretSync.Flyio]: AppConnection.Flyio
|
||||
};
|
||||
|
||||
@@ -146,3 +152,10 @@ export const GCP_SYNC_SCOPES: Record<GcpSyncScope, { name: string; description:
|
||||
description: "Secrets will be synced to the specified region."
|
||||
}
|
||||
};
|
||||
|
||||
export const RENDER_SYNC_SCOPES: Record<RenderSyncScope, { name: string; description: string }> = {
|
||||
[RenderSyncScope.Service]: {
|
||||
name: "Service",
|
||||
description: "Infisical will sync secrets to the specified Render service."
|
||||
}
|
||||
};
|
||||
|
||||
@@ -23,5 +23,6 @@ export enum AppConnection {
|
||||
TeamCity = "teamcity",
|
||||
OCI = "oci",
|
||||
OnePass = "1password",
|
||||
Render = "render",
|
||||
Flyio = "flyio"
|
||||
}
|
||||
|
||||
2
frontend/src/hooks/api/appConnections/render/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from "./queries";
|
||||
export * from "./types";
|
||||
37
frontend/src/hooks/api/appConnections/render/queries.tsx
Normal file
@@ -0,0 +1,37 @@
|
||||
import { useQuery, UseQueryOptions } from "@tanstack/react-query";
|
||||
|
||||
import { apiRequest } from "@app/config/request";
|
||||
|
||||
import { appConnectionKeys } from "../queries";
|
||||
import { TRenderService } from "./types";
|
||||
|
||||
const renderConnectionKeys = {
|
||||
all: [...appConnectionKeys.all, "render"] as const,
|
||||
listServices: (connectionId: string) =>
|
||||
[...renderConnectionKeys.all, "services", connectionId] as const
|
||||
};
|
||||
|
||||
export const useRenderConnectionListServices = (
|
||||
connectionId: string,
|
||||
options?: Omit<
|
||||
UseQueryOptions<
|
||||
TRenderService[],
|
||||
unknown,
|
||||
TRenderService[],
|
||||
ReturnType<typeof renderConnectionKeys.listServices>
|
||||
>,
|
||||
"queryKey" | "queryFn"
|
||||
>
|
||||
) => {
|
||||
return useQuery({
|
||||
queryKey: renderConnectionKeys.listServices(connectionId),
|
||||
queryFn: async () => {
|
||||
const { data } = await apiRequest.get<TRenderService[]>(
|
||||
`/api/v1/app-connections/render/${connectionId}/services`
|
||||
);
|
||||
|
||||
return data;
|
||||
},
|
||||
...options
|
||||
});
|
||||
};
|
||||
4
frontend/src/hooks/api/appConnections/render/types.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export type TRenderService = {
|
||||
id: string;
|
||||
name: string;
|
||||
};
|
||||
@@ -110,6 +110,10 @@ export type TOnePassConnectionOption = TAppConnectionOptionBase & {
|
||||
app: AppConnection.OnePass;
|
||||
};
|
||||
|
||||
export type TRenderConnectionOption = TAppConnectionOptionBase & {
|
||||
app: AppConnection.Render;
|
||||
};
|
||||
|
||||
export type TFlyioConnectionOption = TAppConnectionOptionBase & {
|
||||
app: AppConnection.Flyio;
|
||||
};
|
||||
@@ -137,6 +141,7 @@ export type TAppConnectionOption =
|
||||
| TTeamCityConnectionOption
|
||||
| TOCIConnectionOption
|
||||
| TOnePassConnectionOption
|
||||
| TRenderConnectionOption
|
||||
| TFlyioConnectionOption;
|
||||
|
||||
export type TAppConnectionOptionMap = {
|
||||
@@ -164,5 +169,6 @@ export type TAppConnectionOptionMap = {
|
||||
[AppConnection.TeamCity]: TTeamCityConnectionOption;
|
||||
[AppConnection.OCI]: TOCIConnectionOption;
|
||||
[AppConnection.OnePass]: TOnePassConnectionOption;
|
||||
[AppConnection.Render]: TRenderConnectionOption;
|
||||
[AppConnection.Flyio]: TFlyioConnectionOption;
|
||||
};
|
||||
|
||||
@@ -21,6 +21,7 @@ import { TMySqlConnection } from "./mysql-connection";
|
||||
import { TOCIConnection } from "./oci-connection";
|
||||
import { TOracleDBConnection } from "./oracledb-connection";
|
||||
import { TPostgresConnection } from "./postgres-connection";
|
||||
import { TRenderConnection } from "./render-connection";
|
||||
import { TTeamCityConnection } from "./teamcity-connection";
|
||||
import { TTerraformCloudConnection } from "./terraform-cloud-connection";
|
||||
import { TVercelConnection } from "./vercel-connection";
|
||||
@@ -47,6 +48,7 @@ export * from "./mysql-connection";
|
||||
export * from "./oci-connection";
|
||||
export * from "./oracledb-connection";
|
||||
export * from "./postgres-connection";
|
||||
export * from "./render-connection";
|
||||
export * from "./teamcity-connection";
|
||||
export * from "./terraform-cloud-connection";
|
||||
export * from "./vercel-connection";
|
||||
@@ -77,6 +79,7 @@ export type TAppConnection =
|
||||
| TTeamCityConnection
|
||||
| TOCIConnection
|
||||
| TOnePassConnection
|
||||
| TRenderConnection
|
||||
| TFlyioConnection;
|
||||
|
||||
export type TAvailableAppConnection = Pick<TAppConnection, "name" | "id">;
|
||||
@@ -129,5 +132,6 @@ export type TAppConnectionMap = {
|
||||
[AppConnection.TeamCity]: TTeamCityConnection;
|
||||
[AppConnection.OCI]: TOCIConnection;
|
||||
[AppConnection.OnePass]: TOnePassConnection;
|
||||
[AppConnection.Render]: TRenderConnection;
|
||||
[AppConnection.Flyio]: TFlyioConnection;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
import { AppConnection } from "@app/hooks/api/appConnections/enums";
|
||||
import { TRootAppConnection } from "@app/hooks/api/appConnections/types/root-connection";
|
||||
|
||||
export enum RenderConnectionMethod {
|
||||
ApiKey = "api-key"
|
||||
}
|
||||
|
||||
export type TRenderConnection = TRootAppConnection & { app: AppConnection.Render } & {
|
||||
method: RenderConnectionMethod.ApiKey;
|
||||
credentials: {
|
||||
apiKey: string;
|
||||
};
|
||||
};
|
||||
@@ -16,6 +16,7 @@ export enum SecretSync {
|
||||
TeamCity = "teamcity",
|
||||
OCIVault = "oci-vault",
|
||||
OnePass = "1password",
|
||||
Render = "render",
|
||||
Flyio = "flyio"
|
||||
}
|
||||
|
||||
|
||||
28
frontend/src/hooks/api/secretSyncs/render-sync.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
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 TRenderSync = TRootSecretSync & {
|
||||
destination: SecretSync.Render;
|
||||
destinationConfig: {
|
||||
scope: RenderSyncScope.Service;
|
||||
type: RenderSyncType;
|
||||
serviceId: string;
|
||||
serviceName?: string;
|
||||
};
|
||||
|
||||
connection: {
|
||||
app: AppConnection.Render;
|
||||
name: string;
|
||||
id: string;
|
||||
};
|
||||
};
|
||||
|
||||
export enum RenderSyncScope {
|
||||
Service = "service"
|
||||
}
|
||||
|
||||
export enum RenderSyncType {
|
||||
Env = "env",
|
||||
File = "file"
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
import { SecretSync, SecretSyncImportBehavior } from "@app/hooks/api/secretSyncs";
|
||||
import { DiscriminativePick } from "@app/types";
|
||||
|
||||
import { TRenderSync } from "../render-sync";
|
||||
import { TOnePassSync } from "./1password-sync";
|
||||
import { TAwsParameterStoreSync } from "./aws-parameter-store-sync";
|
||||
import { TAwsSecretsManagerSync } from "./aws-secrets-manager-sync";
|
||||
@@ -45,6 +46,7 @@ export type TSecretSync =
|
||||
| TTeamCitySync
|
||||
| TOCIVaultSync
|
||||
| TOnePassSync
|
||||
| TRenderSync
|
||||
| TFlyioSync;
|
||||
|
||||
export type TListSecretSyncs = { secretSyncs: TSecretSync[] };
|
||||
|
||||
@@ -30,6 +30,7 @@ import { MySqlConnectionForm } from "./MySqlConnectionForm";
|
||||
import { OCIConnectionForm } from "./OCIConnectionForm";
|
||||
import { OracleDBConnectionForm } from "./OracleDBConnectionForm";
|
||||
import { PostgresConnectionForm } from "./PostgresConnectionForm";
|
||||
import { RenderConnectionForm } from "./RenderConnectionForm";
|
||||
import { TeamCityConnectionForm } from "./TeamCityConnectionForm";
|
||||
import { TerraformCloudConnectionForm } from "./TerraformCloudConnectionForm";
|
||||
import { VercelConnectionForm } from "./VercelConnectionForm";
|
||||
@@ -120,6 +121,8 @@ const CreateForm = ({ app, onComplete }: CreateFormProps) => {
|
||||
return <OCIConnectionForm onSubmit={onSubmit} />;
|
||||
case AppConnection.OnePass:
|
||||
return <OnePassConnectionForm onSubmit={onSubmit} />;
|
||||
case AppConnection.Render:
|
||||
return <RenderConnectionForm onSubmit={onSubmit} />;
|
||||
case AppConnection.Flyio:
|
||||
return <FlyioConnectionForm onSubmit={onSubmit} />;
|
||||
default:
|
||||
@@ -206,6 +209,8 @@ const UpdateForm = ({ appConnection, onComplete }: UpdateFormProps) => {
|
||||
return <OCIConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;
|
||||
case AppConnection.OnePass:
|
||||
return <OnePassConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;
|
||||
case AppConnection.Render:
|
||||
return <RenderConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;
|
||||
case AppConnection.Flyio:
|
||||
return <FlyioConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;
|
||||
default:
|
||||
|
||||
@@ -0,0 +1,132 @@
|
||||
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 { RenderConnectionMethod, TRenderConnection } from "@app/hooks/api/appConnections";
|
||||
import { AppConnection } from "@app/hooks/api/appConnections/enums";
|
||||
|
||||
import {
|
||||
genericAppConnectionFieldsSchema,
|
||||
GenericAppConnectionsFields
|
||||
} from "./GenericAppConnectionFields";
|
||||
|
||||
type Props = {
|
||||
appConnection?: TRenderConnection;
|
||||
onSubmit: (formData: FormData) => Promise<void>;
|
||||
};
|
||||
|
||||
const rootSchema = genericAppConnectionFieldsSchema.extend({
|
||||
app: z.literal(AppConnection.Render)
|
||||
});
|
||||
|
||||
const formSchema = z.discriminatedUnion("method", [
|
||||
rootSchema.extend({
|
||||
method: z.literal(RenderConnectionMethod.ApiKey),
|
||||
credentials: z.object({
|
||||
apiKey: z.string().trim().min(1, "API Key required")
|
||||
})
|
||||
})
|
||||
]);
|
||||
|
||||
type FormData = z.infer<typeof formSchema>;
|
||||
|
||||
export const RenderConnectionForm = ({ appConnection, onSubmit }: Props) => {
|
||||
const isUpdate = Boolean(appConnection);
|
||||
|
||||
const form = useForm<FormData>({
|
||||
resolver: zodResolver(formSchema),
|
||||
defaultValues: appConnection ?? {
|
||||
app: AppConnection.Render,
|
||||
method: RenderConnectionMethod.ApiKey
|
||||
}
|
||||
});
|
||||
|
||||
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.Render].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(RenderConnectionMethod).map((method) => {
|
||||
return (
|
||||
<SelectItem value={method} key={method}>
|
||||
{getAppConnectionMethodDetails(method).name}{" "}
|
||||
</SelectItem>
|
||||
);
|
||||
})}
|
||||
</Select>
|
||||
</FormControl>
|
||||
)}
|
||||
/>
|
||||
<Controller
|
||||
name="credentials.apiKey"
|
||||
control={control}
|
||||
shouldUnregister
|
||||
render={({ field: { value, onChange }, fieldState: { error } }) => (
|
||||
<FormControl
|
||||
errorText={error?.message}
|
||||
isError={Boolean(error?.message)}
|
||||
label="API Key"
|
||||
>
|
||||
<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 Render"}
|
||||
</Button>
|
||||
<ModalClose asChild>
|
||||
<Button colorSchema="secondary" variant="plain">
|
||||
Cancel
|
||||
</Button>
|
||||
</ModalClose>
|
||||
</div>
|
||||
</form>
|
||||
</FormProvider>
|
||||
);
|
||||
};
|
||||
@@ -7,7 +7,6 @@ import { Button, Modal, ModalClose, ModalContent } from "@app/components/v2";
|
||||
import { APP_CONNECTION_MAP } from "@app/helpers/appConnections";
|
||||
import { TAppConnection, useUpdateAppConnection } from "@app/hooks/api/appConnections";
|
||||
import { AppConnection } from "@app/hooks/api/appConnections/enums";
|
||||
import { DiscriminativePick } from "@app/types";
|
||||
|
||||
import { genericAppConnectionFieldsSchema, GenericAppConnectionsFields } from "./AppConnectionForm";
|
||||
|
||||
@@ -43,7 +42,7 @@ const Content = ({ appConnection, onComplete }: ContentProps) => {
|
||||
formState: { isSubmitting, isDirty }
|
||||
} = form;
|
||||
|
||||
const onSubmit = async (formData: DiscriminativePick<TAppConnection, "name" | "app">) => {
|
||||
const onSubmit = async (formData: FormData) => {
|
||||
try {
|
||||
await updateAppConnection.mutateAsync({
|
||||
connectionId: appConnection.id,
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
import { useRenderConnectionListServices } from "@app/hooks/api/appConnections/render";
|
||||
import { TRenderSync } from "@app/hooks/api/secretSyncs/render-sync";
|
||||
|
||||
import { getSecretSyncDestinationColValues } from "../helpers";
|
||||
import { SecretSyncTableCell } from "../SecretSyncTableCell";
|
||||
|
||||
type Props = {
|
||||
secretSync: TRenderSync;
|
||||
};
|
||||
|
||||
export const RenderSyncDestinationCol = ({ secretSync }: Props) => {
|
||||
const { data: services = [], isPending } = useRenderConnectionListServices(
|
||||
secretSync.connectionId
|
||||
);
|
||||
|
||||
const { primaryText, secondaryText } = getSecretSyncDestinationColValues({
|
||||
...secretSync,
|
||||
destinationConfig: {
|
||||
...secretSync.destinationConfig,
|
||||
serviceName: services.find((s) => s.id === secretSync.destinationConfig.serviceId)?.name
|
||||
}
|
||||
});
|
||||
|
||||
if (isPending) {
|
||||
return <SecretSyncTableCell primaryText="Loading service info..." secondaryText="Service" />;
|
||||
}
|
||||
|
||||
return <SecretSyncTableCell primaryText={primaryText} secondaryText={secondaryText} />;
|
||||
};
|
||||
@@ -14,6 +14,7 @@ import { GitHubSyncDestinationCol } from "./GitHubSyncDestinationCol";
|
||||
import { HCVaultSyncDestinationCol } from "./HCVaultSyncDestinationCol";
|
||||
import { HumanitecSyncDestinationCol } from "./HumanitecSyncDestinationCol";
|
||||
import { OCIVaultSyncDestinationCol } from "./OCIVaultSyncDestinationCol";
|
||||
import { RenderSyncDestinationCol } from "./RenderSyncDestinationCol";
|
||||
import { TeamCitySyncDestinationCol } from "./TeamCitySyncDestinationCol";
|
||||
import { TerraformCloudSyncDestinationCol } from "./TerraformCloudSyncDestinationCol";
|
||||
import { VercelSyncDestinationCol } from "./VercelSyncDestinationCol";
|
||||
@@ -59,6 +60,8 @@ export const SecretSyncDestinationCol = ({ secretSync }: Props) => {
|
||||
return <OnePassSyncDestinationCol secretSync={secretSync} />;
|
||||
case SecretSync.AzureDevOps:
|
||||
return <AzureDevOpsSyncDestinationCol secretSync={secretSync} />;
|
||||
case SecretSync.Render:
|
||||
return <RenderSyncDestinationCol secretSync={secretSync} />;
|
||||
case SecretSync.Flyio:
|
||||
return <FlyioSyncDestinationCol secretSync={secretSync} />;
|
||||
default:
|
||||
|
||||
@@ -116,6 +116,10 @@ export const getSecretSyncDestinationColValues = (secretSync: TSecretSync) => {
|
||||
primaryText = destinationConfig.devopsProjectName;
|
||||
secondaryText = destinationConfig.devopsProjectId;
|
||||
break;
|
||||
case SecretSync.Render:
|
||||
primaryText = destinationConfig.serviceName ?? destinationConfig.serviceId;
|
||||
secondaryText = "Service";
|
||||
break;
|
||||
case SecretSync.Flyio:
|
||||
primaryText = destinationConfig.appId;
|
||||
secondaryText = "App ID";
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
import { GenericFieldLabel } from "@app/components/secret-syncs";
|
||||
import { useRenderConnectionListServices } from "@app/hooks/api/appConnections/render";
|
||||
import { TRenderSync } from "@app/hooks/api/secretSyncs/render-sync";
|
||||
|
||||
type Props = {
|
||||
secretSync: TRenderSync;
|
||||
};
|
||||
|
||||
export const RenderSyncDestinationSection = ({ secretSync }: Props) => {
|
||||
const { data: services = [], isPending } = useRenderConnectionListServices(
|
||||
secretSync.connectionId
|
||||
);
|
||||
const {
|
||||
destinationConfig: { serviceId }
|
||||
} = secretSync;
|
||||
|
||||
if (isPending) {
|
||||
return <GenericFieldLabel label="Service">Loading...</GenericFieldLabel>;
|
||||
}
|
||||
|
||||
const serviceName = services.find((service) => service.id === serviceId)?.name;
|
||||
return <GenericFieldLabel label="Service">{serviceName ?? serviceId}</GenericFieldLabel>;
|
||||
};
|
||||
@@ -25,6 +25,7 @@ import { GitHubSyncDestinationSection } from "./GitHubSyncDestinationSection";
|
||||
import { HCVaultSyncDestinationSection } from "./HCVaultSyncDestinationSection";
|
||||
import { HumanitecSyncDestinationSection } from "./HumanitecSyncDestinationSection";
|
||||
import { OCIVaultSyncDestinationSection } from "./OCIVaultSyncDestinationSection";
|
||||
import { RenderSyncDestinationSection } from "./RenderSyncDestinationSection";
|
||||
import { TeamCitySyncDestinationSection } from "./TeamCitySyncDestinationSection";
|
||||
import { TerraformCloudSyncDestinationSection } from "./TerraformCloudSyncDestinationSection";
|
||||
import { VercelSyncDestinationSection } from "./VercelSyncDestinationSection";
|
||||
@@ -95,6 +96,9 @@ export const SecretSyncDestinationSection = ({ secretSync, onEditDestination }:
|
||||
case SecretSync.AzureDevOps:
|
||||
DestinationComponents = <AzureDevOpsSyncDestinationSection secretSync={secretSync} />;
|
||||
break;
|
||||
case SecretSync.Render:
|
||||
DestinationComponents = <RenderSyncDestinationSection secretSync={secretSync} />;
|
||||
break;
|
||||
case SecretSync.Flyio:
|
||||
DestinationComponents = <FlyioSyncDestinationSection secretSync={secretSync} />;
|
||||
break;
|
||||
|
||||
@@ -55,6 +55,7 @@ export const SecretSyncOptionsSection = ({ secretSync, onEditOptions }: Props) =
|
||||
case SecretSync.TeamCity:
|
||||
case SecretSync.OCIVault:
|
||||
case SecretSync.OnePass:
|
||||
case SecretSync.Render:
|
||||
case SecretSync.Flyio:
|
||||
AdditionalSyncOptionsComponent = null;
|
||||
break;
|
||||
|
||||