Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

feat(flyio): support automatic redeployment on Fly.io after secret changes

IgorHorta2d5670fe070e
diff --git a/backend/src/lib/api-docs/constants.ts b/backend/src/lib/api-docs/constants.ts
index 773d0cac2b..8b9a435fce 100644
--- a/backend/src/lib/api-docs/constants.ts
+++ b/backend/src/lib/api-docs/constants.ts
@@ -2723,6 +2723,9 @@ export const SecretSyncs = {
RENDER: {
autoRedeployServices:
"Whether Infisical should automatically redeploy the configured Render service upon secret changes."
+ },
+ FLYIO: {
+ autoRedeploy: "Whether Infisical should automatically redeploy the configured Fly.io app upon secret changes."
}
},
DESTINATION_CONFIG: {
diff --git a/backend/src/services/integration-auth/integration-list.ts b/backend/src/services/integration-auth/integration-list.ts
index b76e90470f..e2581d26c8 100644
--- a/backend/src/services/integration-auth/integration-list.ts
+++ b/backend/src/services/integration-auth/integration-list.ts
@@ -76,6 +76,7 @@ export enum IntegrationUrls {
RENDER_API_URL = "https://api.render.com",
RAILWAY_API_URL = "https://backboard.railway.app/graphql/v2",
FLYIO_API_URL = "https://api.fly.io/graphql",
+ FLYIO_MACHINES_API_URL = "https://api.machines.dev/v1",
CIRCLECI_API_URL = "https://circleci.com/api",
TRAVISCI_API_URL = "https://api.travis-ci.com",
SUPABASE_API_URL = "https://api.supabase.com",
diff --git a/backend/src/services/secret-sync/flyio/flyio-sync-fns.ts b/backend/src/services/secret-sync/flyio/flyio-sync-fns.ts
index 7c006fb641..e24c1dcc5d 100644
--- a/backend/src/services/secret-sync/flyio/flyio-sync-fns.ts
+++ b/backend/src/services/secret-sync/flyio/flyio-sync-fns.ts
@@ -1,6 +1,8 @@
+/* eslint-disable no-await-in-loop */
import { request } from "@app/lib/config/request";
import { IntegrationUrls } from "@app/services/integration-auth/integration-list";
import {
+ FlyioGraphQLResponse,
TDeleteFlyioVariable,
TFlyioListVariables,
TFlyioSecret,
@@ -13,7 +15,112 @@ import { TSecretMap } from "@app/services/secret-sync/secret-sync-types";
import { SECRET_SYNC_NAME_MAP } from "../secret-sync-maps";
+const getAppNameByAppId = async ({ accessToken, appId }: TFlyioListVariables) => {
+ const { data } = await request.post<{ data: { app: { name: string } } }>(
+ IntegrationUrls.FLYIO_API_URL,
+ {
+ query: "query GetAppName($appId: String!) { app(id: $appId) { name } }",
+ variables: { appId }
+ },
+ {
+ headers: {
+ Authorization: `Bearer ${accessToken}`,
+ "Content-Type": "application/json",
+ Accept: "application/json"
+ }
+ }
+ );
+
+ return data.data.app.name;
+};
+
+const FLYIO_MACHINE_WAIT_TIMEOUT_SECONDS = 60;
+
+type TFlyioMachineListItem = {
+ id: string;
+ state?: string;
+ region?: string;
+ config?: Record<string, unknown>;
+};
+
+function parseMachinesListResponse(data: unknown): TFlyioMachineListItem[] {
+ if (!Array.isArray(data)) return [];
+ return data as TFlyioMachineListItem[];
+}
+
+/** Fetch all machines for the app. App-level list returns a single array (no pagination). */
+async function listAllMachines(
+ machinesApiBase: string,
+ headers: Record<string, string>
+): Promise<TFlyioMachineListItem[]> {
+ const { data: raw } = await request.get<unknown>(machinesApiBase, { headers });
+ return parseMachinesListResponse(raw);
+}
+
+/**
+ * Deploy secrets to machines: update each machine with the new secrets version so they
+ */
+const deployAppMachines = async (secretSync: TFlyioSyncWithCredentials, releaseVersion: number | undefined) => {
+ const {
+ connection: {
+ credentials: { accessToken }
+ },
+ destinationConfig: { appId }
+ } = secretSync;
+
+ const appNameResolved = await getAppNameByAppId({ accessToken, appId });
+
+ const headers = {
+ Authorization: `Bearer ${accessToken}`,
+ "Content-Type": "application/json",
+ Accept: "application/json"
+ };
+
+ const machinesApiBase = `${IntegrationUrls.FLYIO_MACHINES_API_URL}/apps/${appNameResolved}/machines`;
+
+ const machineList = await listAllMachines(machinesApiBase, headers);
+ const toUpdate = machineList.filter((m) => m.state !== "destroyed" && m.state !== "destroying");
+ if (toUpdate.length === 0) return;
+
+ for (const machine of toUpdate) {
+ let { region, config } = machine;
+ if (!region || config == null) {
+ const { data: fullMachine } = await request.get<{
+ id: string;
+ state: string;
+ region: string;
+ config: Record<string, unknown>;
+ }>(`${machinesApiBase}/${machine.id}`, { headers });
+ ({ region, config } = fullMachine);
+ }
+ if (region && config != null) {
+ const body: {
+ config: Record<string, unknown>;
+ region: string;
+ skip_launch?: boolean;
+ min_secrets_version?: number;
+ } = {
+ config,
+ region
+ };
+ if (releaseVersion != null) {
+ body.min_secrets_version = releaseVersion;
+ }
+ body.skip_launch = false;
+
+ await request.post(`${machinesApiBase}/${machine.id}`, body, { headers });
+
+ await request.get(
+ `${machinesApiBase}/${machine.id}/wait?state=started&timeout=${FLYIO_MACHINE_WAIT_TIMEOUT_SECONDS}`,
+ { headers }
+ );
+ }
+ }
+};
+
const listFlyioSecrets = async ({ accessToken, appId }: TFlyioListVariables) => {
+ // Keep using GraphQL for listing — the Machines REST API list endpoint
+ // has known issues (returns empty arrays in some cases).
const { data } = await request.post<{ data: { app: { secrets: TFlyioSecret[] } } }>(
IntegrationUrls.FLYIO_API_URL,
{
@@ -32,12 +139,20 @@ const listFlyioSecrets = async ({ accessToken, appId }: TFlyioListVariables) =>
return data.data.app.secrets.map((s) => s.name);
};
+// App secrets (NAME=VALUE env vars) must be set via the GraphQL API. The
+// Machines API POST /apps/{name}/secrets is for KMS/secret-key types, not
+// plain app secrets — see https://community.fly.io/t/how-to-create-secrets-via-the-machine-api/24603
const putFlyioSecrets = async ({ accessToken, appId, secretMap }: TPutFlyioVariable) => {
- return request.post(
+ const response = await request.post<FlyioGraphQLResponse<{ setSecrets?: { release?: { version: number } } }>>(
IntegrationUrls.FLYIO_API_URL,
{
- query:
- "mutation SetAppSecrets($appId: ID!, $secrets: [SecretInput!]!) { setSecrets(input: { appId: $appId, secrets: $secrets }) { app { name } release { version } } }",
+ query: `
+ mutation SetAppSecrets($appId: ID!, $secrets: [SecretInput!]!) {
+ setSecrets(input: { appId: $appId, secrets: $secrets }) {
+ release { version }
+ }
+ }
+ `,
variables: {
appId,
secrets: Object.entries(secretMap).map(([key, { value }]) => ({ key, value }))
@@ -46,30 +161,56 @@ const putFlyioSecrets = async ({ accessToken, appId, secretMap }: TPutFlyioVaria
{
headers: {
Authorization: `Bearer ${accessToken}`,
- "Content-Type": "application/json"
+ "Content-Type": "application/json",
+ Accept: "application/json"
}
}
);
+
+ const body = response.data as FlyioGraphQLResponse<{
+ setSecrets?: { release?: { version: number } };
+ }>;
+ if (body.errors?.length) {
+ const messages = body.errors.map((e) => e.message).join("; ");
+ throw new SecretSyncError({ message: `Fly.io setSecrets failed: ${messages}` });
+ }
+ return body.data?.setSecrets?.release?.version;
};
+// Use GraphQL unsetSecrets so keys are sent in the request body (no URL encoding issues).
+// Returns release.version when present (for auto-redeploy); Fly may return null.
const deleteFlyioSecrets = async ({ accessToken, appId, keys }: TDeleteFlyioVariable) => {
- return request.post(
+ if (keys.length === 0) return;
+
+ const response = await request.post<FlyioGraphQLResponse<{ unsetSecrets?: { release?: { version: number } } }>>(
IntegrationUrls.FLYIO_API_URL,
{
- query:
- "mutation UnsetAppSecrets($appId: ID!, $keys: [String!]!) { unsetSecrets(input: { appId: $appId, keys: $keys }) { app { name } release { version } } }",
- variables: {
- appId,
- keys
- }
+ query: `
+ mutation UnsetAppSecrets($appId: ID!, $keys: [String!]!) {
+ unsetSecrets(input: { appId: $appId, keys: $keys }) {
+ release { version }
+ }
+ }
+ `,
+ variables: { appId, keys }
},
{
headers: {
Authorization: `Bearer ${accessToken}`,
- "Content-Type": "application/json"
+ "Content-Type": "application/json",
+ Accept: "application/json"
}
}
);
+
+ const body = response.data as FlyioGraphQLResponse<{
+ unsetSecrets?: { release?: { version: number } };
+ }>;
+ if (body.errors?.length) {
+ const messages = body.errors.map((e) => e.message).join("; ");
+ throw new SecretSyncError({ message: `Fly.io unsetSecrets failed: ${messages}` });
+ }
+ return body.data?.unsetSecrets?.release?.version;
};
export const FlyioSyncFns = {
@@ -82,29 +223,34 @@ export const FlyioSyncFns = {
const { accessToken } = connection.credentials;
+ let releaseVersion: number | undefined;
try {
- await putFlyioSecrets({ accessToken, appId, secretMap });
+ releaseVersion = await putFlyioSecrets({ accessToken, appId, secretMap });
} catch (error) {
throw new SecretSyncError({
error
});
}
- if (secretSync.syncOptions.disableSecretDeletion) return;
+ if (!secretSync.syncOptions.disableSecretDeletion) {
+ const secrets = await listFlyioSecrets({ accessToken, appId });
- const secrets = await listFlyioSecrets({ accessToken, appId });
+ const keys = secrets.filter(
+ (secret) =>
+ matchesSchema(secret, environment?.slug || "", secretSync.syncOptions.keySchema) && !(secret in secretMap)
+ );
- const keys = secrets.filter(
- (secret) =>
- matchesSchema(secret, environment?.slug || "", secretSync.syncOptions.keySchema) && !(secret in secretMap)
- );
+ try {
+ await deleteFlyioSecrets({ accessToken, appId, keys });
+ } catch (error) {
+ throw new SecretSyncError({
+ error
+ });
+ }
+ }
- try {
- await deleteFlyioSecrets({ accessToken, appId, keys });
- } catch (error) {
- throw new SecretSyncError({
- error
- });
+ if (secretSync.syncOptions.autoRedeploy) {
+ await deployAppMachines(secretSync, releaseVersion);
}
},
removeSecrets: async (secretSync: TFlyioSyncWithCredentials, secretMap: TSecretMap) => {
@@ -119,13 +265,18 @@ export const FlyioSyncFns = {
const keys = secrets.filter((secret) => secret in secretMap);
+ let releaseVersion: number | undefined;
try {
- await deleteFlyioSecrets({ accessToken, appId, keys });
+ releaseVersion = await deleteFlyioSecrets({ accessToken, appId, keys });
} catch (error) {
throw new SecretSyncError({
error
});
}
+
+ if (secretSync.syncOptions.autoRedeploy) {
+ await deployAppMachines(secretSync, releaseVersion);
+ }
},
getSecrets: async (secretSync: TFlyioSyncWithCredentials) => {
throw new Error(`${SECRET_SYNC_NAME_MAP[secretSync.destination]} does not support importing secrets.`);
diff --git a/backend/src/services/secret-sync/flyio/flyio-sync-schemas.ts b/backend/src/services/secret-sync/flyio/flyio-sync-schemas.ts
index 4d74269d7f..2324aced62 100644
--- a/backend/src/services/secret-sync/flyio/flyio-sync-schemas.ts
+++ b/backend/src/services/secret-sync/flyio/flyio-sync-schemas.ts
@@ -16,9 +16,13 @@ const FlyioSyncDestinationConfigSchema = z.object({
appId: z.string().trim().min(1, "App required").max(255).describe(SecretSyncs.DESTINATION_CONFIG.FLYIO.appId)
});
+const FlyioSyncOptionsSchema = z.object({
+ autoRedeploy: z.boolean().optional().describe(SecretSyncs.ADDITIONAL_SYNC_OPTIONS.FLYIO.autoRedeploy)
+});
+
const FlyioSyncOptionsConfig: TSyncOptionsConfig = { canImportSecrets: false };
-export const FlyioSyncSchema = BaseSecretSyncSchema(SecretSync.Flyio, FlyioSyncOptionsConfig)
+export const FlyioSyncSchema = BaseSecretSyncSchema(SecretSync.Flyio, FlyioSyncOptionsConfig, FlyioSyncOptionsSchema)
.extend({
destination: z.literal(SecretSync.Flyio),
destinationConfig: FlyioSyncDestinationConfigSchema
@@ -27,14 +31,16 @@ export const FlyioSyncSchema = BaseSecretSyncSchema(SecretSync.Flyio, FlyioSyncO
export const CreateFlyioSyncSchema = GenericCreateSecretSyncFieldsSchema(
SecretSync.Flyio,
- FlyioSyncOptionsConfig
+ FlyioSyncOptionsConfig,
+ FlyioSyncOptionsSchema
).extend({
destinationConfig: FlyioSyncDestinationConfigSchema
});
export const UpdateFlyioSyncSchema = GenericUpdateSecretSyncFieldsSchema(
SecretSync.Flyio,
- FlyioSyncOptionsConfig
+ FlyioSyncOptionsConfig,
+ FlyioSyncOptionsSchema
).extend({
destinationConfig: FlyioSyncDestinationConfigSchema.optional()
});
diff --git a/backend/src/services/secret-sync/flyio/flyio-sync-types.ts b/backend/src/services/secret-sync/flyio/flyio-sync-types.ts
index 336639091e..c4df9a629d 100644
--- a/backend/src/services/secret-sync/flyio/flyio-sync-types.ts
+++ b/backend/src/services/secret-sync/flyio/flyio-sync-types.ts
@@ -30,3 +30,16 @@ export type TPutFlyioVariable = TFlyioListVariables & {
export type TDeleteFlyioVariable = TFlyioListVariables & {
keys: string[];
};
+
+/** GraphQL error shape returned by Fly.io API */
+export type FlyioGraphQLError = {
+ message: string;
+ path?: string[];
+ extensions?: Record<string, unknown>;
+};
+
+/** GraphQL response shape: data and optional errors array (Fly.io returns 200 even on error) */
+export type FlyioGraphQLResponse<T = unknown> = {
+ data?: T;
+ errors?: FlyioGraphQLError[];
+};
diff --git a/docs/integrations/secret-syncs/flyio.mdx b/docs/integrations/secret-syncs/flyio.mdx
index adc8a32d0f..d2537203be 100644
--- a/docs/integrations/secret-syncs/flyio.mdx
+++ b/docs/integrations/secret-syncs/flyio.mdx
@@ -52,6 +52,10 @@ description: "Learn how to configure a Fly.io Sync for Infisical."
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.
+ - **Auto Redeploy On Secret Change**: If enabled, Infisical will restart all app machines after syncing or removing secrets so they pick up the new values immediately.
+ <Note>
+ Fly.io does not expose a way to mark secrets as "deployed". When using auto redeploy, the Fly.io dashboard may show secrets as **Staged** even though they are already applied to running machines (we force machine restarts to load the new secrets). To confirm deployment, check that your machines restarted after the sync (e.g. in the Fly.io Machines view or app logs).
+ </Note>
- **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">
@@ -92,7 +96,8 @@ description: "Learn how to configure a Fly.io Sync for Infisical."
"secretPath": "/my-secrets",
"isEnabled": true,
"syncOptions": {
- "initialSyncBehavior": "overwrite-destination"
+ "initialSyncBehavior": "overwrite-destination",
+ "autoRedeploy": true
},
"destinationConfig": {
"appId": "..."
@@ -127,7 +132,8 @@ description: "Learn how to configure a Fly.io Sync for Infisical."
"lastRemoveMessage": null,
"lastRemovedAt": null,
"syncOptions": {
- "initialSyncBehavior": "overwrite-destination"
+ "initialSyncBehavior": "overwrite-destination",
+ "autoRedeploy": true
},
"projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"connection": {
diff --git a/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/FlyioSyncFields.tsx b/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/FlyioSyncFields.tsx
index a2a5bf844d..f650a53938 100644
--- a/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/FlyioSyncFields.tsx
+++ b/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/FlyioSyncFields.tsx
@@ -37,7 +37,10 @@ export const FlyioSyncFields = () => {
isLoading={isAppsLoading && Boolean(connectionId)}
isDisabled={!connectionId}
value={apps?.find((v) => v.id === value) ?? null}
- onChange={(option) => onChange((option as SingleValue<TFlyioApp>)?.id ?? null)}
+ onChange={(option) => {
+ const selected = option as SingleValue<TFlyioApp>;
+ onChange(selected?.id ?? null);
+ }}
options={apps}
placeholder="Select an app..."
getOptionLabel={(option) => option.name}
diff --git a/frontend/src/components/secret-syncs/forms/SecretSyncOptionsFields/FlyioSyncOptionsFields.tsx b/frontend/src/components/secret-syncs/forms/SecretSyncOptionsFields/FlyioSyncOptionsFields.tsx
new file mode 100644
index 0000000000..a289ba0e8d
--- /dev/null
+++ b/frontend/src/components/secret-syncs/forms/SecretSyncOptionsFields/FlyioSyncOptionsFields.tsx
@@ -0,0 +1,51 @@
+import { Controller, useFormContext } from "react-hook-form";
+import { faQuestionCircle } from "@fortawesome/free-solid-svg-icons";
+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+
+import { FormControl, Switch, Tooltip } from "@app/components/v2";
+import { SecretSync } from "@app/hooks/api/secretSyncs";
+
+import { TSecretSyncForm } from "../schemas";
+
+export const FlyioSyncOptionsFields = () => {
+ const { control } = useFormContext<TSecretSyncForm & { destination: SecretSync.Flyio }>();
+
+ return (
+ <Controller
+ name="syncOptions.autoRedeploy"
+ control={control}
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <FormControl className="mt-4" isError={Boolean(error?.message)} errorText={error?.message}>
+ <Switch
+ className="bg-mineshaft-400/50 shadow-inner data-[state=checked]:bg-green/80"
+ id="auto-redeploy-flyio"
+ thumbClassName="bg-mineshaft-800"
+ isChecked={value}
+ onCheckedChange={onChange}
+ >
+ Auto Redeploy On Secret Change
+ <Tooltip
+ className="max-w-md"
+ content={
+ <div className="space-y-2">
+ <p>
+ If enabled, Infisical will trigger a restart of all app machines after syncing
+ or removing secrets so they pick up the new values immediately.
+ </p>
+ <p>
+ Fly.io does not expose a way to mark secrets as &quot;deployed&quot;, so the
+ Fly.io dashboard may show secrets as <strong>Staged</strong> even though they
+ are already applied. To confirm deployment, check that your machines restarted
+ after the sync (e.g. in the Fly.io Machines view or app logs).
+ </p>
+ </div>
+ }
+ >
+ <FontAwesomeIcon icon={faQuestionCircle} size="sm" className="ml-1" />
+ </Tooltip>
+ </Switch>
+ </FormControl>
+ )}
+ />
+ );
+};
diff --git a/frontend/src/components/secret-syncs/forms/SecretSyncOptionsFields/SecretSyncOptionsFields.tsx b/frontend/src/components/secret-syncs/forms/SecretSyncOptionsFields/SecretSyncOptionsFields.tsx
index 2a55f35c7c..a7da5c2987 100644
--- a/frontend/src/components/secret-syncs/forms/SecretSyncOptionsFields/SecretSyncOptionsFields.tsx
+++ b/frontend/src/components/secret-syncs/forms/SecretSyncOptionsFields/SecretSyncOptionsFields.tsx
@@ -18,6 +18,7 @@ import {
import { TSecretSyncForm } from "../schemas";
import { AwsParameterStoreSyncOptionsFields } from "./AwsParameterStoreSyncOptionsFields";
import { AwsSecretsManagerSyncOptionsFields } from "./AwsSecretsManagerSyncOptionsFields";
+import { FlyioSyncOptionsFields } from "./FlyioSyncOptionsFields";
import { RenderSyncOptionsFields } from "./RenderSyncOptionsFields";
type Props = {
@@ -46,6 +47,9 @@ export const SecretSyncOptionsFields = ({ hideInitialSync }: Props) => {
case SecretSync.Render:
AdditionalSyncOptionsFieldsComponent = <RenderSyncOptionsFields />;
break;
+ case SecretSync.Flyio:
+ AdditionalSyncOptionsFieldsComponent = <FlyioSyncOptionsFields />;
+ break;
case SecretSync.GitHub:
case SecretSync.GCPSecretManager:
case SecretSync.AzureKeyVault:
@@ -62,7 +66,6 @@ export const SecretSyncOptionsFields = ({ hideInitialSync }: Props) => {
case SecretSync.OnePass:
case SecretSync.OCIVault:
case SecretSync.Heroku:
- case SecretSync.Flyio:
case SecretSync.GitLab:
case SecretSync.CloudflarePages:
case SecretSync.CloudflareWorkers:
diff --git a/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/FlyioSyncReviewFields.tsx b/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/FlyioSyncReviewFields.tsx
index 9a1a4bf699..dff711e81f 100644
--- a/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/FlyioSyncReviewFields.tsx
+++ b/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/FlyioSyncReviewFields.tsx
@@ -1,12 +1,39 @@
-import { useFormContext } from "react-hook-form";
+import { useFormContext, useWatch } from "react-hook-form";
import { TSecretSyncForm } from "@app/components/secret-syncs/forms/schemas";
import { GenericFieldLabel } from "@app/components/v2";
+import { Badge } from "@app/components/v3";
+import { useFlyioConnectionListApps } from "@app/hooks/api/appConnections/flyio";
import { SecretSync } from "@app/hooks/api/secretSyncs";
-export const FlyioSyncReviewFields = () => {
+export const FlyioSyncOptionsReviewFields = () => {
const { watch } = useFormContext<TSecretSyncForm & { destination: SecretSync.Flyio }>();
+
+ const [{ autoRedeploy }] = watch(["syncOptions"]);
+
+ return (
+ <div>
+ {autoRedeploy ? (
+ <GenericFieldLabel label="Auto Redeploy">
+ <Badge variant="success">Enabled</Badge>
+ </GenericFieldLabel>
+ ) : (
+ <GenericFieldLabel label="Auto Redeploy">
+ <Badge variant="danger">Disabled</Badge>
+ </GenericFieldLabel>
+ )}
+ </div>
+ );
+};
+
+export const FlyioSyncReviewFields = () => {
+ const { control, watch } = useFormContext<TSecretSyncForm & { destination: SecretSync.Flyio }>();
const appId = watch("destinationConfig.appId");
+ const connectionId = useWatch({ name: "connection.id", control });
+ const { data: apps } = useFlyioConnectionListApps(connectionId, {
+ enabled: Boolean(connectionId)
+ });
+ const displayName = apps?.find((a) => a.id === appId)?.name ?? appId;
- return <GenericFieldLabel label="App ID">{appId}</GenericFieldLabel>;
+ return <GenericFieldLabel label="App">{displayName}</GenericFieldLabel>;
};
diff --git a/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/SecretSyncReviewFields.tsx b/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/SecretSyncReviewFields.tsx
index 29db21c3be..5544768249 100644
--- a/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/SecretSyncReviewFields.tsx
+++ b/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/SecretSyncReviewFields.tsx
@@ -30,7 +30,7 @@ import { CloudflarePagesSyncReviewFields } from "./CloudflarePagesReviewFields";
import { CloudflareWorkersSyncReviewFields } from "./CloudflareWorkersReviewFields";
import { DatabricksSyncReviewFields } from "./DatabricksSyncReviewFields";
import { DigitalOceanAppPlatformSyncReviewFields } from "./DigitalOceanAppPlatformSyncReviewFields";
-import { FlyioSyncReviewFields } from "./FlyioSyncReviewFields";
+import { FlyioSyncOptionsReviewFields, FlyioSyncReviewFields } from "./FlyioSyncReviewFields";
import { GcpSyncReviewFields } from "./GcpSyncReviewFields";
import { GitHubSyncReviewFields } from "./GitHubSyncReviewFields";
import { GitLabSyncReviewFields } from "./GitLabSyncReviewFields";
@@ -143,6 +143,7 @@ export const SecretSyncReviewFields = () => {
break;
case SecretSync.Flyio:
DestinationFieldsComponent = <FlyioSyncReviewFields />;
+ AdditionalSyncOptionsFieldsComponent = <FlyioSyncOptionsReviewFields />;
break;
case SecretSync.GitLab:
DestinationFieldsComponent = <GitLabSyncReviewFields />;
diff --git a/frontend/src/components/secret-syncs/forms/schemas/flyio-sync-destination-schema.ts b/frontend/src/components/secret-syncs/forms/schemas/flyio-sync-destination-schema.ts
index b18081cccb..d7492cb3c9 100644
--- a/frontend/src/components/secret-syncs/forms/schemas/flyio-sync-destination-schema.ts
+++ b/frontend/src/components/secret-syncs/forms/schemas/flyio-sync-destination-schema.ts
@@ -3,7 +3,11 @@ 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 FlyioSyncDestinationSchema = BaseSecretSyncSchema().merge(
+export const FlyioSyncDestinationSchema = BaseSecretSyncSchema(
+ z.object({
+ autoRedeploy: z.boolean().optional()
+ })
+).merge(
z.object({
destination: z.literal(SecretSync.Flyio),
destinationConfig: z.object({
diff --git a/frontend/src/hooks/api/secretSyncs/mutations.tsx b/frontend/src/hooks/api/secretSyncs/mutations.tsx
index bde4ce0260..c108286b61 100644
--- a/frontend/src/hooks/api/secretSyncs/mutations.tsx
+++ b/frontend/src/hooks/api/secretSyncs/mutations.tsx
@@ -39,9 +39,9 @@ export const useUpdateSecretSync = () => {
return data.secretSync;
},
- onSuccess: (_, { syncId, destination, projectId }) => {
+ onSuccess: (updatedSecretSync, { syncId, destination, projectId }) => {
+ queryClient.setQueryData(secretSyncKeys.byId(destination, syncId), updatedSecretSync);
queryClient.invalidateQueries({ queryKey: secretSyncKeys.list(projectId) });
- queryClient.invalidateQueries({ queryKey: secretSyncKeys.byId(destination, syncId) });
}
});
};
diff --git a/frontend/src/hooks/api/secretSyncs/types/flyio-sync.ts b/frontend/src/hooks/api/secretSyncs/types/flyio-sync.ts
index 0717de2c42..39d05d8ee7 100644
--- a/frontend/src/hooks/api/secretSyncs/types/flyio-sync.ts
+++ b/frontend/src/hooks/api/secretSyncs/types/flyio-sync.ts
@@ -1,6 +1,6 @@
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";
+import { RootSyncOptions, TRootSecretSync } from "@app/hooks/api/secretSyncs/types/root-sync";
export type TFlyioSync = TRootSecretSync & {
destination: SecretSync.Flyio;
@@ -12,4 +12,8 @@ export type TFlyioSync = TRootSecretSync & {
name: string;
id: string;
};
+
+ syncOptions: RootSyncOptions & {
+ autoRedeploy?: boolean;
+ };
};
diff --git a/frontend/src/pages/secret-manager/IntegrationsListPage/components/SecretSyncsTab/SecretSyncTable/helpers/index.ts b/frontend/src/pages/secret-manager/IntegrationsListPage/components/SecretSyncsTab/SecretSyncTable/helpers/index.ts
index 98581f0483..c21c9c6e28 100644
--- a/frontend/src/pages/secret-manager/IntegrationsListPage/components/SecretSyncsTab/SecretSyncTable/helpers/index.ts
+++ b/frontend/src/pages/secret-manager/IntegrationsListPage/components/SecretSyncsTab/SecretSyncTable/helpers/index.ts
@@ -139,7 +139,7 @@ export const getSecretSyncDestinationColValues = (secretSync: TSecretSync) => {
break;
case SecretSync.Flyio:
primaryText = destinationConfig.appId;
- secondaryText = "App ID";
+ secondaryText = "App";
break;
case SecretSync.GitLab:
if (destinationConfig.scope === GitLabSyncScope.Project) {
diff --git a/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDestinationSection/FlyioSyncDestinationSection.tsx b/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDestinationSection/FlyioSyncDestinationSection.tsx
index f5132d04be..2e06d2285e 100644
--- a/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDestinationSection/FlyioSyncDestinationSection.tsx
+++ b/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDestinationSection/FlyioSyncDestinationSection.tsx
@@ -10,5 +10,5 @@ export const FlyioSyncDestinationSection = ({ secretSync }: Props) => {
destinationConfig: { appId }
} = secretSync;
- return <GenericFieldLabel label="App ID">{appId}</GenericFieldLabel>;
+ return <GenericFieldLabel label="App">{appId}</GenericFieldLabel>;
};
diff --git a/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncOptionsSection/FlyioSyncOptionsSection.tsx b/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncOptionsSection/FlyioSyncOptionsSection.tsx
new file mode 100644
index 0000000000..b9ce00aab4
--- /dev/null
+++ b/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncOptionsSection/FlyioSyncOptionsSection.tsx
@@ -0,0 +1,21 @@
+import { GenericFieldLabel } from "@app/components/secret-syncs";
+import { Badge } from "@app/components/v3";
+import { TFlyioSync } from "@app/hooks/api/secretSyncs/types/flyio-sync";
+
+type Props = {
+ secretSync: TFlyioSync;
+};
+
+export const FlyioSyncOptionsSection = ({ secretSync }: Props) => {
+ const {
+ syncOptions: { autoRedeploy }
+ } = secretSync;
+
+ return (
+ <GenericFieldLabel label="Auto Redeploy On Secret Change">
+ <Badge variant={autoRedeploy ? "success" : "danger"}>
+ {autoRedeploy ? "Enabled" : "Disabled"}
+ </Badge>
+ </GenericFieldLabel>
+ );
+};
diff --git a/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncOptionsSection/SecretSyncOptionsSection.tsx b/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncOptionsSection/SecretSyncOptionsSection.tsx
index e159c6b9ef..8422529709 100644
--- a/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncOptionsSection/SecretSyncOptionsSection.tsx
+++ b/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncOptionsSection/SecretSyncOptionsSection.tsx
@@ -13,6 +13,7 @@ import { getSecretSyncPermissionSubject } from "@app/lib/fn/permission";
import { AwsParameterStoreSyncOptionsSection } from "./AwsParameterStoreSyncOptionsSection";
import { AwsSecretsManagerSyncOptionsSection } from "./AwsSecretsManagerSyncOptionsSection";
+import { FlyioSyncOptionsSection } from "./FlyioSyncOptionsSection";
import { RenderSyncOptionsSection } from "./RenderSyncOptionsSection";
type Props = {
@@ -42,6 +43,9 @@ export const SecretSyncOptionsSection = ({ secretSync, onEditOptions }: Props) =
case SecretSync.Render:
AdditionalSyncOptionsComponent = <RenderSyncOptionsSection secretSync={secretSync} />;
break;
+ case SecretSync.Flyio:
+ AdditionalSyncOptionsComponent = <FlyioSyncOptionsSection secretSync={secretSync} />;
+ break;
case SecretSync.GitHub:
case SecretSync.GCPSecretManager:
case SecretSync.AzureKeyVault:
@@ -58,7 +62,6 @@ export const SecretSyncOptionsSection = ({ secretSync, onEditOptions }: Props) =
case SecretSync.OCIVault:
case SecretSync.OnePass:
case SecretSync.Heroku:
- case SecretSync.Flyio:
case SecretSync.GitLab:
case SecretSync.CloudflarePages:
case SecretSync.CloudflareWorkers: