Skip to content

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

misc: added autoredeploy option for cf pages integration

Sheen Capadngancd92ce627c0b
diff --git a/backend/src/services/integration-auth/integration-sync-secret.ts b/backend/src/services/integration-auth/integration-sync-secret.ts
index 9d8ee8895d..0ae0a0275d 100644
--- a/backend/src/services/integration-auth/integration-sync-secret.ts
+++ b/backend/src/services/integration-auth/integration-sync-secret.ts
@@ -2750,6 +2750,20 @@ const syncSecretsCloudflarePages = async ({
}
}
);
+
+ const metadata = z.record(z.any()).parse(integration.metadata);
+ if (metadata.shouldAutoRedeploy) {
+ await request.post(
+ `${IntegrationUrls.CLOUDFLARE_PAGES_API_URL}/client/v4/accounts/${accessId}/pages/projects/${integration.app}/deployments`,
+ {},
+ {
+ headers: {
+ Authorization: `Bearer ${accessToken}`,
+ Accept: "application/json"
+ }
+ }
+ );
+ }
};
/**
diff --git a/frontend/src/pages/integrations/cloudflare-pages/create.tsx b/frontend/src/pages/integrations/cloudflare-pages/create.tsx
index 570b2b83a0..d7cb6bdabb 100644
--- a/frontend/src/pages/integrations/cloudflare-pages/create.tsx
+++ b/frontend/src/pages/integrations/cloudflare-pages/create.tsx
@@ -7,7 +7,15 @@ import { createNotification } from "@app/components/notifications";
import { SecretPathInput } from "@app/components/v2/SecretPathInput";
import { useCreateIntegration, useGetWorkspaceById } from "@app/hooks/api";
-import { Button, Card, CardTitle, FormControl, Select, SelectItem } from "../../../components/v2";
+import {
+ Button,
+ Card,
+ CardTitle,
+ FormControl,
+ Select,
+ SelectItem,
+ Switch
+} from "../../../components/v2";
import {
useGetIntegrationAuthApps,
useGetIntegrationAuthById
@@ -34,6 +42,7 @@ export default function CloudflarePagesIntegrationPage() {
const [targetApp, setTargetApp] = useState("");
const [targetAppId, setTargetAppId] = useState("");
const [targetEnvironment, setTargetEnvironment] = useState("");
+ const [shouldAutoRedeploy, setShouldAutoRedeploy] = useState(false);
const [isLoading, setIsLoading] = useState(false);
@@ -69,7 +78,10 @@ export default function CloudflarePagesIntegrationPage() {
appId: targetAppId,
sourceEnvironment: selectedSourceEnvironment,
targetEnvironment,
- secretPath
+ secretPath,
+ metadata: {
+ shouldAutoRedeploy
+ }
});
setIsLoading(false);
@@ -169,6 +181,15 @@ export default function CloudflarePagesIntegrationPage() {
))}
</Select>
</FormControl>
+ <div className="mb-[2.36rem] ml-1 px-6">
+ <Switch
+ id="redeploy-cloudflare-pages"
+ onCheckedChange={(isChecked: boolean) => setShouldAutoRedeploy(isChecked)}
+ isChecked={shouldAutoRedeploy}
+ >
+ Auto-redeploy service upon secret change
+ </Switch>
+ </div>
<Button
onClick={handleButtonClick}
color="mineshaft"