Add vercel secret syncs docs

This commit is contained in:
carlosmonastyrski
2025-04-01 10:56:36 -03:00
parent dbabb4f964
commit 90bf8f800b
36 changed files with 299 additions and 25 deletions

View File

@@ -1787,7 +1787,7 @@ export const SecretSyncs = {
app: "The ID of the Vercel app to sync secrets to.",
appName: "The name of the Vercel app to sync secrets to.",
env: "The ID of the Vercel environment to sync secrets to.",
branch: "The branch to sync secrets to. Required for Preview environments."
branch: "The branch to sync preview secrets to."
}
}
};

View File

@@ -155,7 +155,7 @@ async function fetchPreviewBranches(projectId: string, apiToken: string): Promis
}
}
);
return data.map((b) => b.ref);
return data.filter((b) => b.ref !== "main").map((b) => b.ref);
}
type VercelTeam = {

View File

@@ -12,27 +12,14 @@ import { TSyncOptionsConfig } from "@app/services/secret-sync/secret-sync-types"
import { VercelEnvironmentType } from "./vercel-sync-enums";
const VercelSyncDestinationConfigSchema = z
.object({
app: z.string().min(1, "App ID is required").describe(SecretSyncs.DESTINATION_CONFIG.VERCEL.app),
appName: z.string().min(1, "App Name is required").describe(SecretSyncs.DESTINATION_CONFIG.VERCEL.appName),
env: z
.enum([VercelEnvironmentType.Development, VercelEnvironmentType.Preview, VercelEnvironmentType.Production])
.describe(SecretSyncs.DESTINATION_CONFIG.VERCEL.env),
branch: z.string().optional().describe(SecretSyncs.DESTINATION_CONFIG.VERCEL.branch)
})
.refine(
(data) => {
if (data.env === VercelEnvironmentType.Preview) {
return !!data.branch && data.branch.trim().length > 0;
}
return true;
},
{
message: "Branch is required for Preview environments",
path: ["branch"]
}
);
const VercelSyncDestinationConfigSchema = z.object({
app: z.string().min(1, "App ID is required").describe(SecretSyncs.DESTINATION_CONFIG.VERCEL.app),
appName: z.string().min(1, "App Name is required").describe(SecretSyncs.DESTINATION_CONFIG.VERCEL.appName),
env: z
.enum([VercelEnvironmentType.Development, VercelEnvironmentType.Preview, VercelEnvironmentType.Production])
.describe(SecretSyncs.DESTINATION_CONFIG.VERCEL.env),
branch: z.string().optional().describe(SecretSyncs.DESTINATION_CONFIG.VERCEL.branch)
});
const VercelSyncOptionsConfig: TSyncOptionsConfig = { canImportSecrets: false };

View File

@@ -0,0 +1,4 @@
---
title: "Available"
openapi: "GET /api/v1/app-connections/vercel/available"
---

View File

@@ -0,0 +1,4 @@
---
title: "Create"
openapi: "POST /api/v1/app-connections/vercel"
---

View File

@@ -0,0 +1,4 @@
---
title: "Delete"
openapi: "DELETE /api/v1/app-connections/vercel/{connectionId}"
---

View File

@@ -0,0 +1,4 @@
---
title: "Get by ID"
openapi: "GET /api/v1/app-connections/vercel/{connectionId}"
---

View File

@@ -0,0 +1,4 @@
---
title: "Get by Name"
openapi: "GET /api/v1/app-connections/vercel/connection-name/{connectionName}"
---

View File

@@ -0,0 +1,4 @@
---
title: "List"
openapi: "GET /api/v1/app-connections/vercel"
---

View File

@@ -0,0 +1,4 @@
---
title: "Update"
openapi: "PATCH /api/v1/app-connections/vercel/{connectionId}"
---

View File

@@ -0,0 +1,4 @@
---
title: "Create"
openapi: "POST /api/v1/secret-syncs/vercel"
---

View File

@@ -0,0 +1,4 @@
---
title: "Delete"
openapi: "DELETE /api/v1/secret-syncs/vercel/{syncId}"
---

View File

@@ -0,0 +1,4 @@
---
title: "Get by ID"
openapi: "GET /api/v1/secret-syncs/vercel/{syncId}"
---

View File

@@ -0,0 +1,4 @@
---
title: "Get by Name"
openapi: "GET /api/v1/secret-syncs/vercel/sync-name/{syncName}"
---

View File

@@ -0,0 +1,4 @@
---
title: "List"
openapi: "GET /api/v1/secret-syncs/vercel"
---

View File

@@ -0,0 +1,4 @@
---
title: "Remove Secrets"
openapi: "POST /api/v1/secret-syncs/vercel/{syncId}/remove-secrets"
---

View File

@@ -0,0 +1,4 @@
---
title: "Sync Secrets"
openapi: "POST /api/v1/secret-syncs/vercel/{syncId}/sync-secrets"
---

View File

@@ -0,0 +1,4 @@
---
title: "Update"
openapi: "PATCH /api/v1/secret-syncs/vercel/{syncId}"
---

Binary file not shown.

After

Width:  |  Height:  |  Size: 335 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 233 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 123 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 260 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 372 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 270 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 257 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 241 KiB

View File

@@ -0,0 +1,54 @@
---
title: "Vercel Connection"
description: "Learn how to configure a Vercel Connection for Infisical."
---
Infisical supports connecting to Vercel using an API Token to securely sync your secrets between both platforms.
## Setup Vercel Connection in Infisical
<Steps>
<Step title="Move to API Tokens on Vercel">
Navigate to the Vercel **Account Settings** page by clicking on your profile icon in the top-right corner.
![Vercel API Tokens Tab](/images/app-connections/vercel/vercel-main-page.png)
</Step>
<Step title="Open API Tokens Tab">
Select the **API Tokens** tab from the left sidebar navigation menu.
![Vercel API Tokens Tab](/images/app-connections/vercel/vercel-settings-page.png)
</Step>
<Step title="Create the API Token">
Click the **Create** button and provide a name for your token (e.g., "Infisical Integration").
Choose appropriate scope permissions based on your requirements.
<Note>
If you configure an expiry date for your API token, you will need to manually rotate to a new token prior to expiration to avoid integration downtime. Consider setting a calendar reminder for this task.
</Note>
![Vercel Create API Token](/images/app-connections/vercel/vercel-create-token.png)
</Step>
<Step title="Copy the API Token">
After creation, a modal with the API token will be displayed. Copy this token immediately and store it securely, as you won't be able to view it again after closing this dialog.
![Vercel Copy API Token](/images/app-connections/vercel/vercel-copy-token.png)
</Step>
<Step title="Token Created">
You should now see your newly created token in the list of API tokens on the Vercel dashboard.
![Vercel Connection Created](/images/app-connections/vercel/vercel-token-created.png)
</Step>
<Step title="Navigate to App Connections">
In your Infisical dashboard, go to **Organization Settings** and select the **App Connections** tab.
![App Connections Tab](/images/app-connections/general/add-connection.png)
</Step>
<Step title="Add Connection">
Click the **+ Add Connection** button and select the **Vercel Connection** option from the available integrations.
![Select Vercel Connection](/images/app-connections/vercel/vercel-app-connection-option.png)
</Step>
<Step title="Fill the Vercel Connection Modal">
Complete the Vercel Connection form by entering:
- A descriptive name for the connection
- The API Token you generated in steps 3-4
- An optional description for future reference
![Vercel Connection Modal](/images/app-connections/vercel/vercel-app-connection-modal.png)
</Step>
<Step title="Connection Created">
After clicking Create, your **Vercel Connection** is established and ready to use with your Infisical projects.
![Vercel Connection Created](/images/app-connections/vercel/vercel-app-connection-created.png)
</Step>
</Steps>

View File

@@ -0,0 +1,146 @@
---
title: "Vercel Sync"
description: "Learn how to configure a Vercel Sync for Infisical."
---
**Prerequisites:**
- Set up and add secrets to [Infisical Cloud](https://app.infisical.com)
- Create a [Vercel Connection](/integrations/app-connections/vercel)
<Tabs>
<Tab title="Infisical UI">
1. Navigate to **Project** > **Integrations** and select the **Secret Syncs** tab. Click on the **Add Sync** button.
![Secret Syncs Tab](/images/secret-syncs/general/secret-sync-tab.png)
2. Select the **Vercel** option.
![Select Vercel](/images/secret-syncs/vercel/select-vercel-option.png)
3. Configure the **Source** from where secrets should be retrieved, then click **Next**.
![Configure Source](/images/secret-syncs/vercel/vercel-source.png)
- **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**.
- **Vercel Connection**: The Vercel Connection to authenticate with.
- **Vercel App**: The application to deploy secrets to.
- **Vercel App Environment**: The environment to deploy secrets to.
- **Vercel Preview Branch (Optional)**: Specify a branch for preview deployments if needed.
After configuring these parameters, click the **Next** button to continue to the Sync Options step.
5. Configure the **Sync Options** to specify how secrets should be synced, then click **Next**.
![Configure Options](/images/secret-syncs/vercel/vercel-options.png)
- **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.
<Note>
Vercel does not support importing secrets.
</Note>
- **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 Vercel Sync, then click **Next**.
![Configure Details](/images/secret-syncs/vercel/vercel-details.png)
- **Name**: The name of your sync. Must be slug-friendly.
- **Description**: An optional description for your sync.
7. Review your Vercel Sync configuration, then click **Create Sync**.
![Confirm Configuration](/images/secret-syncs/vercel/vercel-review.png)
8. If enabled, your Vercel Sync will begin syncing your secrets to the destination endpoint.
![Sync Secrets](/images/secret-syncs/vercel/vercel-created.png)
</Tab>
<Tab title="API">
To create an **Vercel Sync**, make an API request to the [Create Vercel Sync](/api-reference/endpoints/secret-syncs/vercel/create) API endpoint.
### Sample request
```bash Request
curl --request POST \
--url https://app.infisical.com/api/v1/secret-syncs/vercel \
--header 'Content-Type: application/json' \
--data '{
"name": "my-vercel-sync",
"projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"description": "an example sync",
"connectionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"environment": "dev",
"secretPath": "/my-secrets",
"isEnabled": true,
"syncOptions": {
"initialSyncBehavior": "overwrite-destination"
},
"destinationConfig": {
"app": "prj_bz7zgHvQETPvJWc5tmIr0tGRH9kE",
"env": "preview",
"branch": "test",
"appName": "nextjs-boilerplate"
}
}'
```
### Sample response
```bash Response
{
"secretSync": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "my-vercel-sync",
"description": "an example sync",
"isEnabled": true,
"version": 1,
"folderId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"connectionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"syncStatus": "succeeded",
"lastSyncJobId": "123",
"lastSyncMessage": null,
"lastSyncedAt": "2023-11-07T05:31:56Z",
"importStatus": null,
"lastImportJobId": null,
"lastImportMessage": null,
"lastImportedAt": null,
"removeStatus": null,
"lastRemoveJobId": null,
"lastRemoveMessage": null,
"lastRemovedAt": null,
"syncOptions": {
"initialSyncBehavior": "overwrite-destination"
},
"projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"connection": {
"app": "vercel",
"name": "my-vercel-connection",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"environment": {
"slug": "dev",
"name": "Development",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"folder": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"path": "/my-secrets"
},
"destination": "vercel",
"destinationConfig": {
"app": "prj_bz7zgHvQETPvJWc5tmIr0tGRH9kE",
"env": "preview",
"branch": "test",
"appName": "nextjs-boilerplate"
}
}
}
```
</Tab>
</Tabs>

View File

@@ -419,7 +419,8 @@
"integrations/app-connections/databricks",
"integrations/app-connections/gcp",
"integrations/app-connections/github",
"integrations/app-connections/humanitec"
"integrations/app-connections/humanitec",
"integrations/app-connections/vercel"
]
}
]
@@ -438,7 +439,8 @@
"integrations/secret-syncs/databricks",
"integrations/secret-syncs/gcp-secret-manager",
"integrations/secret-syncs/github",
"integrations/secret-syncs/humanitec"
"integrations/secret-syncs/humanitec",
"integrations/secret-syncs/vercel"
]
}
]
@@ -922,6 +924,18 @@
"api-reference/endpoints/app-connections/humanitec/update",
"api-reference/endpoints/app-connections/humanitec/delete"
]
},
{
"group": "Vercel",
"pages": [
"api-reference/endpoints/app-connections/vercel/list",
"api-reference/endpoints/app-connections/vercel/available",
"api-reference/endpoints/app-connections/vercel/get-by-id",
"api-reference/endpoints/app-connections/vercel/get-by-name",
"api-reference/endpoints/app-connections/vercel/create",
"api-reference/endpoints/app-connections/vercel/update",
"api-reference/endpoints/app-connections/vercel/delete"
]
}
]
},
@@ -1038,6 +1052,19 @@
"api-reference/endpoints/secret-syncs/humanitec/sync-secrets",
"api-reference/endpoints/secret-syncs/humanitec/remove-secrets"
]
},
{
"group": "Vercel",
"pages": [
"api-reference/endpoints/secret-syncs/vercel/list",
"api-reference/endpoints/secret-syncs/vercel/get-by-id",
"api-reference/endpoints/secret-syncs/vercel/get-by-name",
"api-reference/endpoints/secret-syncs/vercel/create",
"api-reference/endpoints/secret-syncs/vercel/update",
"api-reference/endpoints/secret-syncs/vercel/delete",
"api-reference/endpoints/secret-syncs/vercel/sync-secrets",
"api-reference/endpoints/secret-syncs/vercel/remove-secrets"
]
}
]
},