Skip to content

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

allow pages and workers to add types

DimitrisStaratzis7914a7ca5bce
diff --git a/backend/src/lib/api-docs/constants.ts b/backend/src/lib/api-docs/constants.ts
index 0d1d0a3905..1ab15e6296 100644
--- a/backend/src/lib/api-docs/constants.ts
+++ b/backend/src/lib/api-docs/constants.ts
@@ -3292,9 +3292,15 @@ export const SecretSyncs = {
disableCertificateImport:
"Whether Infisical should skip importing certificate objects from Azure Key Vault when syncing secrets."
},
+ CLOUDFLARE_PAGES: {
+ variableType:
+ "The type of environment variable to sync secrets as: secret_text (default) or plain_text. Infisical only deletes variables of this type."
+ },
CLOUDFLARE_WORKERS: {
syncNonSecretBindings:
- "Whether Infisical should also sync plaintext and JSON variable bindings in addition to secret bindings."
+ "Whether Infisical should also sync plaintext and JSON variable bindings in addition to secret bindings. Only applies when variableType is secret_text.",
+ variableType:
+ "The type of variable to sync secrets as: secret_text (default), plain_text or json. With plain_text or json, Infisical replaces any secret or variable of the same name and only deletes variables of that type."
},
SPACELIFT: {
writeOnly:
diff --git a/backend/src/services/secret-sync/cloudflare-pages/cloudflare-pages-constants.ts b/backend/src/services/secret-sync/cloudflare-pages/cloudflare-pages-constants.ts
index a62192e98f..f7cec5a294 100644
--- a/backend/src/services/secret-sync/cloudflare-pages/cloudflare-pages-constants.ts
+++ b/backend/src/services/secret-sync/cloudflare-pages/cloudflare-pages-constants.ts
@@ -2,6 +2,11 @@ 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 enum CloudflarePagesVariableType {
+ Secret = "secret_text",
+ Text = "plain_text"
+}
+
export const CLOUDFLARE_PAGES_SYNC_LIST_OPTION: TSecretSyncListItem = {
name: "Cloudflare Pages",
destination: SecretSync.CloudflarePages,
diff --git a/backend/src/services/secret-sync/cloudflare-pages/cloudflare-pages-fns.test.ts b/backend/src/services/secret-sync/cloudflare-pages/cloudflare-pages-fns.test.ts
new file mode 100644
index 0000000000..14b3526deb
--- /dev/null
+++ b/backend/src/services/secret-sync/cloudflare-pages/cloudflare-pages-fns.test.ts
@@ -0,0 +1,74 @@
+import { beforeEach, describe, expect, it, vi } from "vitest";
+
+import { TSecretSyncPayload } from "../secret-sync-payload";
+import { CloudflarePagesVariableType } from "./cloudflare-pages-constants";
+import { CloudflarePagesSyncFns } from "./cloudflare-pages-fns";
+import { TCloudflarePagesSyncWithCredentials } from "./cloudflare-pages-types";
+
+vi.mock("@app/lib/config/env", () => ({ getConfig: () => ({}) }));
+
+const { get, patch } = vi.hoisted(() => ({
+ get: vi.fn(),
+ patch: vi.fn().mockResolvedValue({})
+}));
+vi.mock("@app/lib/config/request", async (importOriginal) => ({
+ ...(await importOriginal<object>()),
+ request: { get, patch }
+}));
+
+const syncWith = (syncOptions: Record<string, unknown>) =>
+ ({
+ destination: "cloudflare-pages",
+ destinationConfig: { projectName: "my-site", environment: "production" },
+ environment: { slug: "prod" },
+ syncOptions: { disableSecretDeletion: false, ...syncOptions },
+ connection: { credentials: { apiToken: "token", accountId: "account-id" } }
+ }) as unknown as TCloudflarePagesSyncWithCredentials;
+
+const payloadOf = (secrets: Record<string, string>) =>
+ ({
+ flatten: () => Object.fromEntries(Object.entries(secrets).map(([key, value]) => [key, { value }]))
+ }) as unknown as TSecretSyncPayload;
+
+describe("CloudflarePagesSyncFns", () => {
+ beforeEach(() => {
+ vi.clearAllMocks();
+ });
+
+ it("writes text variables and deletes only stale text variables", async () => {
+ get.mockResolvedValue({
+ data: {
+ result: {
+ deployment_configs: {
+ production: {
+ env_vars: {
+ STALE_TEXT: { type: "plain_text", value: "old" },
+ OTHER_SECRET: { type: "secret_text", value: "" }
+ }
+ }
+ }
+ }
+ }
+ });
+
+ await CloudflarePagesSyncFns.syncSecrets(
+ syncWith({ variableType: CloudflarePagesVariableType.Text }),
+ payloadOf({ API_URL: "https://api.example.com" })
+ );
+
+ expect(patch).toHaveBeenCalledWith(
+ expect.stringMatching(/\/pages\/projects\/my-site$/),
+ {
+ deployment_configs: {
+ production: {
+ env_vars: {
+ API_URL: { type: "plain_text", value: "https://api.example.com" },
+ STALE_TEXT: null
+ }
+ }
+ }
+ },
+ expect.anything()
+ );
+ });
+});
diff --git a/backend/src/services/secret-sync/cloudflare-pages/cloudflare-pages-fns.ts b/backend/src/services/secret-sync/cloudflare-pages/cloudflare-pages-fns.ts
index 31a39f979d..47602ed32d 100644
--- a/backend/src/services/secret-sync/cloudflare-pages/cloudflare-pages-fns.ts
+++ b/backend/src/services/secret-sync/cloudflare-pages/cloudflare-pages-fns.ts
@@ -5,11 +5,13 @@ import { TSecretSyncPayload } from "@app/services/secret-sync/secret-sync-payloa
import { TSecretMap } from "@app/services/secret-sync/secret-sync-types";
import { SECRET_SYNC_NAME_MAP } from "../secret-sync-maps";
+import { CloudflarePagesVariableType } from "./cloudflare-pages-constants";
import { TCloudflarePagesSyncWithCredentials } from "./cloudflare-pages-types";
const getProjectEnvironmentSecrets = async (secretSync: TCloudflarePagesSyncWithCredentials) => {
const {
destinationConfig,
+ syncOptions: { variableType = CloudflarePagesVariableType.Secret },
connection: {
credentials: { apiToken, accountId }
}
@@ -21,7 +23,7 @@ const getProjectEnvironmentSecrets = async (secretSync: TCloudflarePagesSyncWith
deployment_configs: Record<
string,
{
- env_vars: Record<string, { type: "plain_text" | "secret_text"; value: string }>;
+ env_vars: Record<string, { type: CloudflarePagesVariableType; value: string }>;
}
>;
};
@@ -36,10 +38,13 @@ const getProjectEnvironmentSecrets = async (secretSync: TCloudflarePagesSyncWith
)
).data.result.deployment_configs[destinationConfig.environment].env_vars;
- return Object.entries(secrets ?? {}).map(([key, envVar]) => ({
- key,
- value: envVar.value
- }));
+ // A sync only owns variables of the type it writes, so syncs of different types can share an environment.
+ return Object.entries(secrets ?? {})
+ .filter(([, envVar]) => envVar.type === variableType)
+ .map(([key, envVar]) => ({
+ key,
+ value: envVar.value
+ }));
};
export const CloudflarePagesSyncFns = {
@@ -47,6 +52,7 @@ export const CloudflarePagesSyncFns = {
const secretMap = payload.flatten();
const {
destinationConfig,
+ syncOptions: { variableType = CloudflarePagesVariableType.Secret },
connection: {
credentials: { apiToken, accountId }
}
@@ -55,7 +61,7 @@ export const CloudflarePagesSyncFns = {
// Create/update secret entries
let secretEntries: [string, object | null][] = Object.entries(secretMap).map(([key, val]) => [
key,
- { type: "secret_text", value: val.value }
+ { type: variableType, value: val.value }
]);
// Handle deletions if not disabled
diff --git a/backend/src/services/secret-sync/cloudflare-pages/cloudflare-pages-schema.ts b/backend/src/services/secret-sync/cloudflare-pages/cloudflare-pages-schema.ts
index 47a3b6564c..ffc06c5a77 100644
--- a/backend/src/services/secret-sync/cloudflare-pages/cloudflare-pages-schema.ts
+++ b/backend/src/services/secret-sync/cloudflare-pages/cloudflare-pages-schema.ts
@@ -11,6 +11,7 @@ import {
import { TSyncOptionsConfig } from "@app/services/secret-sync/secret-sync-types";
import { SECRET_SYNC_NAME_MAP } from "../secret-sync-maps";
+import { CloudflarePagesVariableType } from "./cloudflare-pages-constants";
const CloudflarePagesSyncDestinationConfigSchema = z.object({
projectName: z
@@ -23,11 +24,19 @@ const CloudflarePagesSyncDestinationConfigSchema = z.object({
.describe(SecretSyncs.DESTINATION_CONFIG.CLOUDFLARE_PAGES.environment)
});
+const CloudflarePagesSyncAdditionalOptionsSchema = z.object({
+ variableType: z
+ .nativeEnum(CloudflarePagesVariableType)
+ .optional()
+ .describe(SecretSyncs.ADDITIONAL_SYNC_OPTIONS.CLOUDFLARE_PAGES.variableType)
+});
+
const CloudflarePagesSyncOptionsConfig: TSyncOptionsConfig = { canImportSecrets: false };
export const CloudflarePagesSyncSchema = BaseSecretSyncSchema(
SecretSync.CloudflarePages,
- CloudflarePagesSyncOptionsConfig
+ CloudflarePagesSyncOptionsConfig,
+ CloudflarePagesSyncAdditionalOptionsSchema
)
.extend({
destination: z.literal(SecretSync.CloudflarePages),
@@ -37,14 +46,16 @@ export const CloudflarePagesSyncSchema = BaseSecretSyncSchema(
export const CreateCloudflarePagesSyncSchema = GenericCreateSecretSyncFieldsSchema(
SecretSync.CloudflarePages,
- CloudflarePagesSyncOptionsConfig
+ CloudflarePagesSyncOptionsConfig,
+ CloudflarePagesSyncAdditionalOptionsSchema
).extend({
destinationConfig: CloudflarePagesSyncDestinationConfigSchema
});
export const UpdateCloudflarePagesSyncSchema = GenericUpdateSecretSyncFieldsSchema(
SecretSync.CloudflarePages,
- CloudflarePagesSyncOptionsConfig
+ CloudflarePagesSyncOptionsConfig,
+ CloudflarePagesSyncAdditionalOptionsSchema
).extend({
destinationConfig: CloudflarePagesSyncDestinationConfigSchema.optional()
});
diff --git a/backend/src/services/secret-sync/cloudflare-workers/cloudflare-workers-constants.ts b/backend/src/services/secret-sync/cloudflare-workers/cloudflare-workers-constants.ts
index 2b00a0cbf7..f527545409 100644
--- a/backend/src/services/secret-sync/cloudflare-workers/cloudflare-workers-constants.ts
+++ b/backend/src/services/secret-sync/cloudflare-workers/cloudflare-workers-constants.ts
@@ -2,6 +2,12 @@ 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 enum CloudflareWorkersVariableType {
+ Secret = "secret_text",
+ Text = "plain_text",
+ Json = "json"
+}
+
export const CLOUDFLARE_WORKERS_SYNC_LIST_OPTION: TSecretSyncListItem = {
name: "Cloudflare Workers",
destination: SecretSync.CloudflareWorkers,
diff --git a/backend/src/services/secret-sync/cloudflare-workers/cloudflare-workers-fns.test.ts b/backend/src/services/secret-sync/cloudflare-workers/cloudflare-workers-fns.test.ts
new file mode 100644
index 0000000000..b988b11f2a
--- /dev/null
+++ b/backend/src/services/secret-sync/cloudflare-workers/cloudflare-workers-fns.test.ts
@@ -0,0 +1,100 @@
+import { beforeEach, describe, expect, it, vi } from "vitest";
+
+import { TSecretSyncPayload } from "../secret-sync-payload";
+import { CloudflareWorkersVariableType } from "./cloudflare-workers-constants";
+import { CloudflareWorkersSyncFns } from "./cloudflare-workers-fns";
+import { TCloudflareWorkersSyncWithCredentials } from "./cloudflare-workers-types";
+
+vi.mock("@app/lib/config/env", () => ({ getConfig: () => ({}) }));
+
+const { get, patch } = vi.hoisted(() => ({
+ get: vi.fn(),
+ patch: vi.fn().mockResolvedValue({ data: { success: true } })
+}));
+vi.mock("@app/lib/config/request", async (importOriginal) => ({
+ ...(await importOriginal<object>()),
+ request: { get, patch }
+}));
+
+type TBinding = { type: string; name: string; text?: string; json?: unknown };
+
+const syncWith = (syncOptions: Record<string, unknown>) =>
+ ({
+ destination: "cloudflare-workers",
+ destinationConfig: { scriptId: "my-worker" },
+ environment: { slug: "prod" },
+ syncOptions: { disableSecretDeletion: false, ...syncOptions },
+ connection: { credentials: { apiToken: "token", accountId: "account-id" } }
+ }) as unknown as TCloudflareWorkersSyncWithCredentials;
+
+const payloadOf = (secrets: Record<string, string>) =>
+ ({
+ flatten: () => Object.fromEntries(Object.entries(secrets).map(([key, value]) => [key, { value }]))
+ }) as unknown as TSecretSyncPayload;
+
+const stubWorker = (bindings: TBinding[]) =>
+ get.mockImplementation(async (url: string) =>
+ url.endsWith("/secrets")
+ ? { data: { result: bindings.filter(({ type }) => type === "secret_text") } }
+ : { data: { result: { bindings } } }
+ );
+
+const patchedBindings = async () => {
+ const [, formData] = patch.mock.calls[0] as [string, FormData];
+ return (JSON.parse(await (formData.get("settings") as Blob).text()) as { bindings: TBinding[] }).bindings;
+};
+
+describe("CloudflareWorkersSyncFns", () => {
+ beforeEach(() => {
+ vi.clearAllMocks();
+ });
+
+ it("writes text variables in one settings update, replacing a same-name secret and deleting only stale text variables", async () => {
+ stubWorker([
+ { type: "secret_text", name: "API_KEY" },
+ { type: "plain_text", name: "STALE", text: "old" },
+ { type: "json", name: "CONFIG", json: { a: 1 } },
+ { type: "kv_namespace", name: "CACHE" }
+ ]);
+
+ await CloudflareWorkersSyncFns.syncSecrets(
+ syncWith({ variableType: CloudflareWorkersVariableType.Text }),
+ payloadOf({ API_KEY: "key", NEW_VAR: "new" })
+ );
+
+ expect(patch).toHaveBeenCalledTimes(1);
+ expect(patch.mock.calls[0][0]).toMatch(/\/workers\/scripts\/my-worker\/settings$/);
+ expect(await patchedBindings()).toEqual([
+ { type: "json", name: "CONFIG", json: { a: 1 } },
+ { type: "kv_namespace", name: "CACHE" },
+ { type: "plain_text", name: "API_KEY", text: "key" },
+ { type: "plain_text", name: "NEW_VAR", text: "new" }
+ ]);
+ });
+
+ it("rejects values that are not JSON before calling Cloudflare", async () => {
+ await expect(
+ CloudflareWorkersSyncFns.syncSecrets(
+ syncWith({ variableType: CloudflareWorkersVariableType.Json }),
+ payloadOf({ VALID: '{"a":1}', BROKEN: "not json" })
+ )
+ ).rejects.toThrow("cannot be synced as Cloudflare Workers JSON variables: BROKEN.");
+
+ expect(get).not.toHaveBeenCalled();
+ });
+
+ it("removes only variables of the sync's type", async () => {
+ stubWorker([
+ { type: "plain_text", name: "TEXT_VAR", text: "a" },
+ { type: "secret_text", name: "SECRET_VAR" }
+ ]);
+
+ await CloudflareWorkersSyncFns.removeSecrets(
+ syncWith({ variableType: CloudflareWorkersVariableType.Text }),
+ payloadOf({ TEXT_VAR: "a", SECRET_VAR: "b" })
+ );
+
+ expect(patch).toHaveBeenCalledTimes(1);
+ expect(await patchedBindings()).toEqual([{ type: "secret_text", name: "SECRET_VAR" }]);
+ });
+});
diff --git a/backend/src/services/secret-sync/cloudflare-workers/cloudflare-workers-fns.ts b/backend/src/services/secret-sync/cloudflare-workers/cloudflare-workers-fns.ts
index b2280b84f6..b506e3a7f2 100644
--- a/backend/src/services/secret-sync/cloudflare-workers/cloudflare-workers-fns.ts
+++ b/backend/src/services/secret-sync/cloudflare-workers/cloudflare-workers-fns.ts
@@ -10,6 +10,7 @@ import { TSecretSyncPayload } from "@app/services/secret-sync/secret-sync-payloa
import { TSecretMap } from "@app/services/secret-sync/secret-sync-types";
import { SECRET_SYNC_NAME_MAP } from "../secret-sync-maps";
+import { CloudflareWorkersVariableType } from "./cloudflare-workers-constants";
import { TCloudflareWorkersSyncWithCredentials } from "./cloudflare-workers-types";
const CLOUDFLARE_UNDEPLOYED_VERSION_ERROR_CODE = 10215;
@@ -148,6 +149,95 @@ const getCloudflareBindings = async (
return { secrets, nonSecretBindings };
};
+// A text or JSON sync only owns variables of its type, so syncs of different types can share a Worker.
+const $getManagedBindings = (
+ secretSync: TCloudflareWorkersSyncWithCredentials,
+ { secrets, nonSecretBindings }: TCloudflareBindings
+) => {
+ const { variableType = CloudflareWorkersVariableType.Secret, syncNonSecretBindings } = secretSync.syncOptions;
+
+ if (variableType !== CloudflareWorkersVariableType.Secret) {
+ return nonSecretBindings.filter((binding) => binding.type === variableType);
+ }
+
+ return syncNonSecretBindings ? [...secrets, ...nonSecretBindings] : secrets;
+};
+
+// Text and JSON variables are bindings in the Worker's settings, which take the full binding list. One
+// PATCH therefore creates and updates them, replaces a secret or variable of another type with the same
+// name, and deletes the ones no longer in Infisical.
+const $syncVariableBindings = async (
+ secretSync: TCloudflareWorkersSyncWithCredentials,
+ secretMap: TSecretMap,
+ variableType: CloudflareWorkersVariableType.Text | CloudflareWorkersVariableType.Json
+) => {
+ const {
+ connection: {
+ credentials: { apiToken, accountId }
+ },
+ destinationConfig: { scriptId },
+ syncOptions: { disableSecretDeletion, keySchema }
+ } = secretSync;
+
+ const variableBindings: Array<{ type: string; name: string; text?: string; json?: unknown }> = [];
+ const invalidJsonKeys: string[] = [];
+
+ for (const [name, { value }] of Object.entries(secretMap)) {
+ if (variableType === CloudflareWorkersVariableType.Text) {
+ variableBindings.push({ type: variableType, name, text: value });
+ } else {
+ try {
+ variableBindings.push({ type: variableType, name, json: JSON.parse(value) as unknown });
+ } catch {
+ invalidJsonKeys.push(name);
+ }
+ }
+ }
+
+ if (invalidJsonKeys.length > 0) {
+ throw new SecretSyncError({
+ message: `The following secrets are not valid JSON, so they cannot be synced as Cloudflare Workers JSON variables: ${invalidJsonKeys.join(", ")}. Fix their values in Infisical or change the sync's variable type.`,
+ shouldRetry: false
+ });
+ }
+
+ const secretMapKeys = new Set(Object.keys(secretMap));
+ const isDeleted = (binding: { type: string; name: string }) =>
+ !disableSecretDeletion &&
+ binding.type === variableType &&
+ matchesSchema(binding.name, secretSync.environment?.slug || "", keySchema);
+
+ const settingsUrl = `${IntegrationUrls.CLOUDFLARE_WORKERS_API_URL}/client/v4/accounts/${accountId}/workers/scripts/${scriptId}/settings`;
+
+ try {
+ const { data: settingsData } = await request.get<{
+ result: { bindings: Array<{ type: string; name: string; text?: string; json?: string }> };
+ }>(settingsUrl, {
+ headers: {
+ Authorization: `Bearer ${apiToken}`,
+ Accept: "application/json"
+ }
+ });
+
+ const bindings = [
+ ...settingsData.result.bindings.filter((binding) => !secretMapKeys.has(binding.name) && !isDeleted(binding)),
+ ...variableBindings
+ ];
+
+ const formData = new FormData();
+ formData.append("settings", new Blob([JSON.stringify({ bindings })], { type: "application/json" }));
+
+ const { data: settingsPatchData } = await request.patch<TCloudflareApiResponse>(settingsUrl, formData, {
+ headers: {
+ Authorization: `Bearer ${apiToken}`
+ }
+ });
+ $validateCloudflareResponse(settingsPatchData);
+ } catch (err) {
+ throwOnCloudflareRequestError(err);
+ }
+};
+
export const CloudflareWorkersSyncFns = {
syncSecrets: async (secretSync: TCloudflareWorkersSyncWithCredentials, payload: TSecretSyncPayload) => {
const secretMap = payload.flatten();
@@ -155,17 +245,21 @@ export const CloudflareWorkersSyncFns = {
connection: {
credentials: { apiToken, accountId }
},
- destinationConfig: { scriptId }
+ destinationConfig: { scriptId },
+ syncOptions: { variableType = CloudflareWorkersVariableType.Secret }
} = secretSync;
+ if (variableType !== CloudflareWorkersVariableType.Secret) {
+ await $syncVariableBindings(secretSync, secretMap, variableType);
+ return;
+ }
+
const shouldSyncNonSecretBindings = Boolean(secretSync.syncOptions.syncNonSecretBindings);
- const { secrets: existingSecretBindings, nonSecretBindings } = await getCloudflareBindings(secretSync);
+ const cloudflareBindings = await getCloudflareBindings(secretSync);
- const existingSecrets = shouldSyncNonSecretBindings
- ? [...existingSecretBindings, ...nonSecretBindings]
- : existingSecretBindings;
+ const existingSecrets = $getManagedBindings(secretSync, cloudflareBindings);
- const nonSecretBindingKeys = new Set(nonSecretBindings.map((b) => b.key));
+ const nonSecretBindingKeys = new Set(cloudflareBindings.nonSecretBindings.map((b) => b.key));
const existingSecretsMap = Object.fromEntries(existingSecrets.map(({ key, type }) => [key, type]));
const secretMapKeys = new Set(Object.keys(secretMap));
@@ -359,12 +453,7 @@ export const CloudflareWorkersSyncFns = {
destinationConfig: { scriptId }
} = secretSync;
- const shouldSyncNonSecretBindings = Boolean(secretSync.syncOptions.syncNonSecretBindings);
- const { secrets: existingSecretBindings, nonSecretBindings } = await getCloudflareBindings(secretSync);
-
- const existingSecretNames = shouldSyncNonSecretBindings
- ? [...existingSecretBindings, ...nonSecretBindings]
- : existingSecretBindings;
+ const existingSecretNames = $getManagedBindings(secretSync, await getCloudflareBindings(secretSync));
const secretMapToRemoveKeys = new Set(Object.keys(secretMap));
diff --git a/backend/src/services/secret-sync/cloudflare-workers/cloudflare-workers-schemas.ts b/backend/src/services/secret-sync/cloudflare-workers/cloudflare-workers-schemas.ts
index 1b88651d4c..5e129134e9 100644
--- a/backend/src/services/secret-sync/cloudflare-workers/cloudflare-workers-schemas.ts
+++ b/backend/src/services/secret-sync/cloudflare-workers/cloudflare-workers-schemas.ts
@@ -12,6 +12,7 @@ import {
import { TSyncOptionsConfig } from "@app/services/secret-sync/secret-sync-types";
import { SECRET_SYNC_NAME_MAP } from "../secret-sync-maps";
+import { CloudflareWorkersVariableType } from "./cloudflare-workers-constants";
const CloudflareWorkersSyncDestinationConfigSchema = z.object({
scriptId: z
@@ -29,7 +30,11 @@ const CloudflareWorkersSyncAdditionalOptionsSchema = z.object({
syncNonSecretBindings: z
.boolean()
.optional()
- .describe(SecretSyncs.ADDITIONAL_SYNC_OPTIONS.CLOUDFLARE_WORKERS.syncNonSecretBindings)
+ .describe(SecretSyncs.ADDITIONAL_SYNC_OPTIONS.CLOUDFLARE_WORKERS.syncNonSecretBindings),
+ variableType: z
+ .nativeEnum(CloudflareWorkersVariableType)
+ .optional()
+ .describe(SecretSyncs.ADDITIONAL_SYNC_OPTIONS.CLOUDFLARE_WORKERS.variableType)
});
const CloudflareWorkersSyncOptionsConfig: TSyncOptionsConfig = { canImportSecrets: false };
diff --git a/docs/integrations/secret-syncs/cloudflare-pages.mdx b/docs/integrations/secret-syncs/cloudflare-pages.mdx
index b930ce63bb..829920350e 100644
--- a/docs/integrations/secret-syncs/cloudflare-pages.mdx
+++ b/docs/integrations/secret-syncs/cloudflare-pages.mdx
@@ -42,6 +42,13 @@ description: "Learn how to configure a Cloudflare Pages Sync for Infisical."
- **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.
+ - **Variable type**: How Cloudflare stores each synced secret
+ - **Secret**: Encrypted, so you can't read the value in the Cloudflare dashboard
+ - **Text**: Plain text that you can read in the Cloudflare dashboard
+
+ <Tip>
+ To sync both secrets and text variables to one environment, create one sync of each type from different folders. Each sync only deletes variables of its own type.
+ </Tip>
6. Configure the **Details** of your Cloudflare Pages Sync, then click **Next**.
![Configure Details](/images/secret-syncs/cloudflare-pages/cloudflare-pages-sync-details.png)
diff --git a/docs/integrations/secret-syncs/cloudflare-workers.mdx b/docs/integrations/secret-syncs/cloudflare-workers.mdx
index 2fcb209323..4970e68f6f 100644
--- a/docs/integrations/secret-syncs/cloudflare-workers.mdx
+++ b/docs/integrations/secret-syncs/cloudflare-workers.mdx
@@ -41,6 +41,10 @@ description: "Learn how to configure a Cloudflare Workers Sync for Infisical."
- **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.
+ - **Variable type**: How Cloudflare stores each synced secret
+ - **Secret**: Encrypted, so you can't read the value in the Cloudflare dashboard
+ - **Text**: Plain text that you can read in the Cloudflare dashboard
+ - **JSON**: A JSON value that your Worker receives already parsed (each secret value must be valid JSON)
6. Configure the **Details** of your Cloudflare Workers Sync, then click **Next**.
![Configure Details](/images/secret-syncs/cloudflare-workers/cloudflare-workers-sync-details.png)
diff --git a/frontend/src/components/secret-syncs/forms/SecretSyncOptionsFields/CloudflarePagesSyncOptionsFields.tsx b/frontend/src/components/secret-syncs/forms/SecretSyncOptionsFields/CloudflarePagesSyncOptionsFields.tsx
new file mode 100644
index 0000000000..4900b3428c
--- /dev/null
+++ b/frontend/src/components/secret-syncs/forms/SecretSyncOptionsFields/CloudflarePagesSyncOptionsFields.tsx
@@ -0,0 +1,60 @@
+import { Controller, useFormContext } from "react-hook-form";
+
+import {
+ Field,
+ FieldContent,
+ FieldDescription,
+ FieldError,
+ FieldLabel,
+ Select,
+ SelectContent,
+ SelectItem,
+ SelectTrigger,
+ SelectValue
+} from "@app/components/v3";
+import { CLOUDFLARE_PAGES_VARIABLE_TYPE_LABELS } from "@app/helpers/secretSyncs";
+import { SecretSync } from "@app/hooks/api/secretSyncs";
+import { CloudflarePagesVariableType } from "@app/hooks/api/secretSyncs/types/cloudflare-pages-sync";
+
+import { TSecretSyncForm } from "../schemas";
+
+export const CloudflarePagesSyncOptionsFields = () => {
+ const { control } = useFormContext<
+ TSecretSyncForm & { destination: SecretSync.CloudflarePages }
+ >();
+
+ return (
+ <Controller
+ name="syncOptions.variableType"
+ control={control}
+ defaultValue={CloudflarePagesVariableType.Secret}
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <Field className="mb-4">
+ <FieldLabel htmlFor="cloudflare-pages-variable-type">Variable type</FieldLabel>
+ <FieldContent>
+ <Select value={value} onValueChange={onChange}>
+ <SelectTrigger
+ id="cloudflare-pages-variable-type"
+ className="w-full"
+ isError={Boolean(error)}
+ >
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent position="popper">
+ {Object.entries(CLOUDFLARE_PAGES_VARIABLE_TYPE_LABELS).map(([type, label]) => (
+ <SelectItem value={type} key={type}>
+ {label}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ <FieldDescription>
+ Secrets are encrypted in Cloudflare, while text variables stay readable.
+ </FieldDescription>
+ <FieldError errors={[error]} />
+ </FieldContent>
+ </Field>
+ )}
+ />
+ );
+};
diff --git a/frontend/src/components/secret-syncs/forms/SecretSyncOptionsFields/CloudflareWorkersSyncOptionsFields.tsx b/frontend/src/components/secret-syncs/forms/SecretSyncOptionsFields/CloudflareWorkersSyncOptionsFields.tsx
index 70e49d10c1..772836f20e 100644
--- a/frontend/src/components/secret-syncs/forms/SecretSyncOptionsFields/CloudflareWorkersSyncOptionsFields.tsx
+++ b/frontend/src/components/secret-syncs/forms/SecretSyncOptionsFields/CloudflareWorkersSyncOptionsFields.tsx
@@ -9,10 +9,18 @@ import {
FieldContent,
FieldDescription,
FieldError,
+ FieldLabel,
Label,
+ Select,
+ SelectContent,
+ SelectItem,
+ SelectTrigger,
+ SelectValue,
Toggle
} from "@app/components/v3";
+import { CLOUDFLARE_WORKERS_VARIABLE_TYPE_LABELS } from "@app/helpers/secretSyncs";
import { SecretSync } from "@app/hooks/api/secretSyncs";
+import { CloudflareWorkersVariableType } from "@app/hooks/api/secretSyncs/types/cloudflare-workers-sync";
import { TSecretSyncForm } from "../schemas";
@@ -23,45 +31,84 @@ export const CloudflareWorkersSyncOptionsFields = () => {
const disableSecretDeletion = watch("syncOptions.disableSecretDeletion");
const syncNonSecretBindings = watch("syncOptions.syncNonSecretBindings");
+ const variableType = watch("syncOptions.variableType", CloudflareWorkersVariableType.Secret);
return (
<>
<Controller
- name="syncOptions.syncNonSecretBindings"
+ name="syncOptions.variableType"
control={control}
+ defaultValue={CloudflareWorkersVariableType.Secret}
render={({ field: { value, onChange }, fieldState: { error } }) => (
<Field className="mb-4">
- <Field orientation="horizontal">
- <FieldContent>
- <Label htmlFor="sync-non-secret-bindings">Sync plaintext and JSON variables</Label>
- <FieldDescription>
- When enabled, Infisical will also sync plaintext and JSON variable bindings in
- addition to secret bindings. Infisical can only update existing plaintext and JSON
- bindings on Cloudflare Workers, not create new ones.
- </FieldDescription>
- </FieldContent>
- <Toggle
- id="sync-non-secret-bindings"
- variant="project"
- checked={value}
- onCheckedChange={onChange}
- />
- </Field>
- <FieldError errors={[error]} />
+ <FieldLabel htmlFor="cloudflare-workers-variable-type">Variable type</FieldLabel>
+ <FieldContent>
+ <Select value={value} onValueChange={onChange}>
+ <SelectTrigger
+ id="cloudflare-workers-variable-type"
+ className="w-full"
+ isError={Boolean(error)}
+ >
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent position="popper">
+ {Object.entries(CLOUDFLARE_WORKERS_VARIABLE_TYPE_LABELS).map(([type, label]) => (
+ <SelectItem value={type} key={type}>
+ {label}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ <FieldDescription>
+ Secrets are encrypted in Cloudflare, while text and JSON variables stay readable.
+ </FieldDescription>
+ <FieldError errors={[error]} />
+ </FieldContent>
</Field>
)}
/>
- {syncNonSecretBindings && !disableSecretDeletion && (
- <Alert variant="warning" className="mb-4">
- <TriangleAlert />
- <AlertTitle>Plaintext and JSON variables may be deleted</AlertTitle>
- <AlertDescription>
- With &quot;Prevent secret deletion&quot; turned off and non-secret binding sync turned
- on, any plaintext or JSON variables in Cloudflare Workers that are not present in
- Infisical will be removed during a sync. Turn on &quot;Prevent secret deletion&quot;
- above to keep them.
- </AlertDescription>
- </Alert>
+ {variableType === CloudflareWorkersVariableType.Secret && (
+ <>
+ <Controller
+ name="syncOptions.syncNonSecretBindings"
+ control={control}
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <Field className="mb-4">
+ <Field orientation="horizontal">
+ <FieldContent>
+ <Label htmlFor="sync-non-secret-bindings">
+ Sync plaintext and JSON variables
+ </Label>
+ <FieldDescription>
+ When enabled, Infisical will also sync plaintext and JSON variable bindings in
+ addition to secret bindings. Infisical can only update existing plaintext and
+ JSON bindings on Cloudflare Workers, not create new ones.
+ </FieldDescription>
+ </FieldContent>
+ <Toggle
+ id="sync-non-secret-bindings"
+ variant="project"
+ checked={value}
+ onCheckedChange={onChange}
+ />
+ </Field>
+ <FieldError errors={[error]} />
+ </Field>
+ )}
+ />
+ {syncNonSecretBindings && !disableSecretDeletion && (
+ <Alert variant="warning" className="mb-4">
+ <TriangleAlert />
+ <AlertTitle>Plaintext and JSON variables may be deleted</AlertTitle>
+ <AlertDescription>
+ With &quot;Prevent secret deletion&quot; turned off and non-secret binding sync
+ turned on, any plaintext or JSON variables in Cloudflare Workers that are not
+ present in Infisical will be removed during a sync. Turn on &quot;Prevent secret
+ deletion&quot; above to keep them.
+ </AlertDescription>
+ </Alert>
+ )}
+ </>
)}
</>
);
diff --git a/frontend/src/components/secret-syncs/forms/SecretSyncOptionsFields/SecretSyncOptionsFields.tsx b/frontend/src/components/secret-syncs/forms/SecretSyncOptionsFields/SecretSyncOptionsFields.tsx
index 28e6a6b8d1..62ba73fb73 100644
--- a/frontend/src/components/secret-syncs/forms/SecretSyncOptionsFields/SecretSyncOptionsFields.tsx
+++ b/frontend/src/components/secret-syncs/forms/SecretSyncOptionsFields/SecretSyncOptionsFields.tsx
@@ -40,6 +40,7 @@ import { InitialSyncAlerts } from "../SecretSyncInitialSyncBehaviorFields";
import { AwsParameterStoreSyncOptionsFields } from "./AwsParameterStoreSyncOptionsFields";
import { AwsSecretsManagerSyncOptionsFields } from "./AwsSecretsManagerSyncOptionsFields";
import { AzureKeyVaultSyncOptionsFields } from "./AzureKeyVaultSyncOptionsFields";
+import { CloudflarePagesSyncOptionsFields } from "./CloudflarePagesSyncOptionsFields";
import { CloudflareWorkersSyncOptionsFields } from "./CloudflareWorkersSyncOptionsFields";
import { FlyioSyncOptionsFields } from "./FlyioSyncOptionsFields";
import { QoverySyncOptionsFields } from "./QoverySyncOptionsFields";
@@ -131,6 +132,8 @@ export const SecretSyncOptionsFields = ({ hideInitialSync, children }: Props) =>
AdditionalSyncOptionsFieldsComponent = <CloudflareWorkersSyncOptionsFields />;
break;
case SecretSync.CloudflarePages:
+ AdditionalSyncOptionsFieldsComponent = <CloudflarePagesSyncOptionsFields />;
+ break;
case SecretSync.CloudflareSecretsStore:
case SecretSync.Zabbix:
case SecretSync.Railway:
diff --git a/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/CloudflarePagesReviewFields.tsx b/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/CloudflarePagesReviewFields.tsx
index bb7290dccc..c602cb3f5d 100644
--- a/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/CloudflarePagesReviewFields.tsx
+++ b/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/CloudflarePagesReviewFields.tsx
@@ -2,8 +2,21 @@ import { useFormContext } from "react-hook-form";
import { TSecretSyncForm } from "@app/components/secret-syncs/forms/schemas";
import { Detail, DetailLabel, DetailValue } from "@app/components/v3";
+import { CLOUDFLARE_PAGES_VARIABLE_TYPE_LABELS } from "@app/helpers/secretSyncs";
import { SecretSync } from "@app/hooks/api/secretSyncs";
+export const CloudflarePagesSyncOptionsReviewFields = () => {
+ const { watch } = useFormContext<TSecretSyncForm & { destination: SecretSync.CloudflarePages }>();
+ const variableType = watch("syncOptions.variableType");
+
+ return (
+ <Detail>
+ <DetailLabel>Variable Type</DetailLabel>
+ <DetailValue>{CLOUDFLARE_PAGES_VARIABLE_TYPE_LABELS[variableType]}</DetailValue>
+ </Detail>
+ );
+};
+
export const CloudflarePagesSyncReviewFields = () => {
const { watch } = useFormContext<TSecretSyncForm & { destination: SecretSync.CloudflarePages }>();
const projectName = watch("destinationConfig.projectName");
diff --git a/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/CloudflareWorkersReviewFields.tsx b/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/CloudflareWorkersReviewFields.tsx
index dcb2508733..cbc827032c 100644
--- a/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/CloudflareWorkersReviewFields.tsx
+++ b/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/CloudflareWorkersReviewFields.tsx
@@ -2,24 +2,34 @@ import { useFormContext } from "react-hook-form";
import { TSecretSyncForm } from "@app/components/secret-syncs/forms/schemas";
import { Badge, Detail, DetailLabel, DetailValue } from "@app/components/v3";
+import { CLOUDFLARE_WORKERS_VARIABLE_TYPE_LABELS } from "@app/helpers/secretSyncs";
import { SecretSync } from "@app/hooks/api/secretSyncs";
+import { CloudflareWorkersVariableType } from "@app/hooks/api/secretSyncs/types/cloudflare-workers-sync";
export const CloudflareWorkersSyncOptionsReviewFields = () => {
const { watch } = useFormContext<
TSecretSyncForm & { destination: SecretSync.CloudflareWorkers }
>();
- const [{ syncNonSecretBindings }] = watch(["syncOptions"]);
+ const [{ syncNonSecretBindings, variableType }] = watch(["syncOptions"]);
return (
- <Detail>
- <DetailLabel>Sync Plaintext and JSON Variables</DetailLabel>
- <DetailValue>
- <Badge variant={syncNonSecretBindings ? "success" : "danger"}>
- {syncNonSecretBindings ? "Enabled" : "Disabled"}
- </Badge>
- </DetailValue>
- </Detail>
+ <>
+ <Detail>
+ <DetailLabel>Variable Type</DetailLabel>
+ <DetailValue>{CLOUDFLARE_WORKERS_VARIABLE_TYPE_LABELS[variableType]}</DetailValue>
+ </Detail>
+ {variableType === CloudflareWorkersVariableType.Secret && (
+ <Detail>
+ <DetailLabel>Sync Plaintext and JSON Variables</DetailLabel>
+ <DetailValue>
+ <Badge variant={syncNonSecretBindings ? "success" : "danger"}>
+ {syncNonSecretBindings ? "Enabled" : "Disabled"}
+ </Badge>
+ </DetailValue>
+ </Detail>
+ )}
+ </>
);
};
diff --git a/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/SecretSyncReviewFields.tsx b/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/SecretSyncReviewFields.tsx
index 5242fae5ac..87f44d67ef 100644
--- a/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/SecretSyncReviewFields.tsx
+++ b/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/SecretSyncReviewFields.tsx
@@ -39,7 +39,10 @@ import { ChecklySyncReviewFields } from "./ChecklySyncReviewFields";
import { ChefSyncReviewFields } from "./ChefSyncReviewFields";
import { CircleCISyncReviewFields } from "./CircleCISyncReviewFields";
import { Cloud66SyncReviewFields } from "./Cloud66SyncReviewFields";
-import { CloudflarePagesSyncReviewFields } from "./CloudflarePagesReviewFields";
+import {
+ CloudflarePagesSyncOptionsReviewFields,
+ CloudflarePagesSyncReviewFields
+} from "./CloudflarePagesReviewFields";
import { CloudflareSecretsStoreSyncReviewFields } from "./CloudflareSecretsStoreSyncReviewFields";
import {
CloudflareWorkersSyncOptionsReviewFields,
@@ -186,6 +189,7 @@ export const SecretSyncReviewFields = () => {
break;
case SecretSync.CloudflarePages:
DestinationFieldsComponent = <CloudflarePagesSyncReviewFields />;
+ AdditionalSyncOptionsFieldsComponent = <CloudflarePagesSyncOptionsReviewFields />;
break;
case SecretSync.CloudflareWorkers:
DestinationFieldsComponent = <CloudflareWorkersSyncReviewFields />;
diff --git a/frontend/src/components/secret-syncs/forms/schemas/cloudflare-pages-sync-destination-schema.ts b/frontend/src/components/secret-syncs/forms/schemas/cloudflare-pages-sync-destination-schema.ts
index 807c99dc20..48e39dc20a 100644
--- a/frontend/src/components/secret-syncs/forms/schemas/cloudflare-pages-sync-destination-schema.ts
+++ b/frontend/src/components/secret-syncs/forms/schemas/cloudflare-pages-sync-destination-schema.ts
@@ -2,8 +2,15 @@ import { z } from "zod";
import { BaseSecretSyncSchema } from "@app/components/secret-syncs/forms/schemas/base-secret-sync-schema";
import { SecretSync } from "@app/hooks/api/secretSyncs/enums";
+import { CloudflarePagesVariableType } from "@app/hooks/api/secretSyncs/types/cloudflare-pages-sync";
-export const CloudflarePagesSyncDestinationSchema = BaseSecretSyncSchema().merge(
+export const CloudflarePagesSyncDestinationSchema = BaseSecretSyncSchema(
+ z.object({
+ variableType: z
+ .nativeEnum(CloudflarePagesVariableType)
+ .default(CloudflarePagesVariableType.Secret)
+ })
+).merge(
z.object({
destination: z.literal(SecretSync.CloudflarePages),
destinationConfig: z.object({
diff --git a/frontend/src/components/secret-syncs/forms/schemas/cloudflare-workers-sync-destination-schema.ts b/frontend/src/components/secret-syncs/forms/schemas/cloudflare-workers-sync-destination-schema.ts
index ab59ad8e85..4d51f79ffa 100644
--- a/frontend/src/components/secret-syncs/forms/schemas/cloudflare-workers-sync-destination-schema.ts
+++ b/frontend/src/components/secret-syncs/forms/schemas/cloudflare-workers-sync-destination-schema.ts
@@ -2,10 +2,14 @@ import { z } from "zod";
import { BaseSecretSyncSchema } from "@app/components/secret-syncs/forms/schemas/base-secret-sync-schema";
import { SecretSync } from "@app/hooks/api/secretSyncs/enums";
+import { CloudflareWorkersVariableType } from "@app/hooks/api/secretSyncs/types/cloudflare-workers-sync";
export const CloudflareWorkersSyncDestinationSchema = BaseSecretSyncSchema(
z.object({
- syncNonSecretBindings: z.boolean().optional().default(false)
+ syncNonSecretBindings: z.boolean().optional().default(false),
+ variableType: z
+ .nativeEnum(CloudflareWorkersVariableType)
+ .default(CloudflareWorkersVariableType.Secret)
})
).merge(
z.object({
diff --git a/frontend/src/helpers/secretSyncs.ts b/frontend/src/helpers/secretSyncs.ts
index 805c7bd9b3..af468a764d 100644
--- a/frontend/src/helpers/secretSyncs.ts
+++ b/frontend/src/helpers/secretSyncs.ts
@@ -4,7 +4,9 @@ import {
SecretSyncImportBehavior,
SecretSyncInitialSyncBehavior
} from "@app/hooks/api/secretSyncs";
+import { CloudflarePagesVariableType } from "@app/hooks/api/secretSyncs/types/cloudflare-pages-sync";
import { CloudflareSecretsStoreScope } from "@app/hooks/api/secretSyncs/types/cloudflare-secrets-store-sync";
+import { CloudflareWorkersVariableType } from "@app/hooks/api/secretSyncs/types/cloudflare-workers-sync";
import { GcpSyncScope } from "@app/hooks/api/secretSyncs/types/gcp-sync";
import { HumanitecSyncScope } from "@app/hooks/api/secretSyncs/types/humanitec-sync";
import { RenderSyncScope } from "@app/hooks/api/secretSyncs/types/render-sync";
@@ -476,3 +478,17 @@ export const CLOUDFLARE_SECRETS_STORE_SCOPE_LABELS: Record<CloudflareSecretsStor
[CloudflareSecretsStoreScope.AiGateway]: "AI Gateway",
[CloudflareSecretsStoreScope.Containers]: "Containers"
};
+
+export const CLOUDFLARE_PAGES_VARIABLE_TYPE_LABELS: Record<CloudflarePagesVariableType, string> = {
+ [CloudflarePagesVariableType.Secret]: "Secret",
+ [CloudflarePagesVariableType.Text]: "Text"
+};
+
+export const CLOUDFLARE_WORKERS_VARIABLE_TYPE_LABELS: Record<
+ CloudflareWorkersVariableType,
+ string
+> = {
+ [CloudflareWorkersVariableType.Secret]: "Secret",
+ [CloudflareWorkersVariableType.Text]: "Text",
+ [CloudflareWorkersVariableType.Json]: "JSON"
+};
diff --git a/frontend/src/hooks/api/secretSyncs/types/cloudflare-pages-sync.ts b/frontend/src/hooks/api/secretSyncs/types/cloudflare-pages-sync.ts
index 14fc268b74..68278092b9 100644
--- a/frontend/src/hooks/api/secretSyncs/types/cloudflare-pages-sync.ts
+++ b/frontend/src/hooks/api/secretSyncs/types/cloudflare-pages-sync.ts
@@ -1,6 +1,11 @@
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 enum CloudflarePagesVariableType {
+ Secret = "secret_text",
+ Text = "plain_text"
+}
export type TCloudflarePagesSync = TRootSecretSync & {
destination: SecretSync.CloudflarePages;
@@ -13,4 +18,7 @@ export type TCloudflarePagesSync = TRootSecretSync & {
name: string;
id: string;
};
+ syncOptions: RootSyncOptions & {
+ variableType?: CloudflarePagesVariableType;
+ };
};
diff --git a/frontend/src/hooks/api/secretSyncs/types/cloudflare-workers-sync.ts b/frontend/src/hooks/api/secretSyncs/types/cloudflare-workers-sync.ts
index d75de9d713..966eec3b8a 100644
--- a/frontend/src/hooks/api/secretSyncs/types/cloudflare-workers-sync.ts
+++ b/frontend/src/hooks/api/secretSyncs/types/cloudflare-workers-sync.ts
@@ -2,6 +2,12 @@ import { AppConnection } from "@app/hooks/api/appConnections/enums";
import { SecretSync } from "@app/hooks/api/secretSyncs";
import { RootSyncOptions, TRootSecretSync } from "@app/hooks/api/secretSyncs/types/root-sync";
+export enum CloudflareWorkersVariableType {
+ Secret = "secret_text",
+ Text = "plain_text",
+ Json = "json"
+}
+
export type TCloudflareWorkersSync = TRootSecretSync & {
destination: SecretSync.CloudflareWorkers;
destinationConfig: {
@@ -14,5 +20,6 @@ export type TCloudflareWorkersSync = TRootSecretSync & {
};
syncOptions: RootSyncOptions & {
syncNonSecretBindings?: boolean;
+ variableType?: CloudflareWorkersVariableType;
};
};
diff --git a/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncOptionsSection/CloudflarePagesSyncOptionsSection.tsx b/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncOptionsSection/CloudflarePagesSyncOptionsSection.tsx
new file mode 100644
index 0000000000..370a3f58f9
--- /dev/null
+++ b/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncOptionsSection/CloudflarePagesSyncOptionsSection.tsx
@@ -0,0 +1,23 @@
+import { Detail, DetailLabel, DetailValue } from "@app/components/v3";
+import { CLOUDFLARE_PAGES_VARIABLE_TYPE_LABELS } from "@app/helpers/secretSyncs";
+import {
+ CloudflarePagesVariableType,
+ TCloudflarePagesSync
+} from "@app/hooks/api/secretSyncs/types/cloudflare-pages-sync";
+
+type Props = {
+ secretSync: TCloudflarePagesSync;
+};
+
+export const CloudflarePagesSyncOptionsSection = ({ secretSync }: Props) => {
+ const {
+ syncOptions: { variableType = CloudflarePagesVariableType.Secret }
+ } = secretSync;
+
+ return (
+ <Detail>
+ <DetailLabel>Variable Type</DetailLabel>
+ <DetailValue>{CLOUDFLARE_PAGES_VARIABLE_TYPE_LABELS[variableType]}</DetailValue>
+ </Detail>
+ );
+};
diff --git a/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncOptionsSection/CloudflareWorkersSyncOptionsSection.tsx b/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncOptionsSection/CloudflareWorkersSyncOptionsSection.tsx
new file mode 100644
index 0000000000..e2c97d0bfb
--- /dev/null
+++ b/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncOptionsSection/CloudflareWorkersSyncOptionsSection.tsx
@@ -0,0 +1,23 @@
+import { Detail, DetailLabel, DetailValue } from "@app/components/v3";
+import { CLOUDFLARE_WORKERS_VARIABLE_TYPE_LABELS } from "@app/helpers/secretSyncs";
+import {
+ CloudflareWorkersVariableType,
+ TCloudflareWorkersSync
+} from "@app/hooks/api/secretSyncs/types/cloudflare-workers-sync";
+
+type Props = {
+ secretSync: TCloudflareWorkersSync;
+};
+
+export const CloudflareWorkersSyncOptionsSection = ({ secretSync }: Props) => {
+ const {
+ syncOptions: { variableType = CloudflareWorkersVariableType.Secret }
+ } = secretSync;
+
+ return (
+ <Detail>
+ <DetailLabel>Variable Type</DetailLabel>
+ <DetailValue>{CLOUDFLARE_WORKERS_VARIABLE_TYPE_LABELS[variableType]}</DetailValue>
+ </Detail>
+ );
+};
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 662980e588..6ee5f5f18b 100644
--- a/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncOptionsSection/SecretSyncOptionsSection.tsx
+++ b/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncOptionsSection/SecretSyncOptionsSection.tsx
@@ -17,6 +17,8 @@ import { SecretSync, TSecretSync } from "@app/hooks/api/secretSyncs";
import { AwsParameterStoreSyncOptionsSection } from "./AwsParameterStoreSyncOptionsSection";
import { AwsSecretsManagerSyncOptionsSection } from "./AwsSecretsManagerSyncOptionsSection";
+import { CloudflarePagesSyncOptionsSection } from "./CloudflarePagesSyncOptionsSection";
+import { CloudflareWorkersSyncOptionsSection } from "./CloudflareWorkersSyncOptionsSection";
import { FlyioSyncOptionsSection } from "./FlyioSyncOptionsSection";
import { QoverySyncOptionsSection } from "./QoverySyncOptionsSection";
import { RenderSyncOptionsSection } from "./RenderSyncOptionsSection";
@@ -58,6 +60,16 @@ export const SecretSyncOptionsSection = ({ secretSync }: Props) => {
case SecretSync.Qovery:
AdditionalSyncOptionsComponent = <QoverySyncOptionsSection secretSync={secretSync} />;
break;
+ case SecretSync.CloudflarePages:
+ AdditionalSyncOptionsComponent = (
+ <CloudflarePagesSyncOptionsSection secretSync={secretSync} />
+ );
+ break;
+ case SecretSync.CloudflareWorkers:
+ AdditionalSyncOptionsComponent = (
+ <CloudflareWorkersSyncOptionsSection secretSync={secretSync} />
+ );
+ break;
case SecretSync.GitHub:
case SecretSync.GCPSecretManager:
case SecretSync.AzureKeyVault:
@@ -75,8 +87,6 @@ export const SecretSyncOptionsSection = ({ secretSync }: Props) => {
case SecretSync.OnePass:
case SecretSync.Heroku:
case SecretSync.GitLab:
- case SecretSync.CloudflarePages:
- case SecretSync.CloudflareWorkers:
case SecretSync.CloudflareSecretsStore:
case SecretSync.Zabbix:
case SecretSync.Railway: