Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/long-flies-look.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@workflow/world-vercel": patch
---

Allow overwriting backend URL via env variable
5 changes: 4 additions & 1 deletion packages/world-vercel/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,15 @@ export const getHttpUrl = (
const projectConfig = config?.projectConfig;
const defaultHost =
WORKFLOW_SERVER_URL_OVERRIDE || 'https://vercel-workflow.com';
const customProxyUrl = process.env.WORKFLOW_VERCEL_BACKEND_URL;
const defaultProxyUrl = 'https://api.vercel.com/v1/workflow';
// Use proxy when we have project config (for authentication via Vercel API)
const usingProxy = Boolean(projectConfig?.projectId && projectConfig?.teamId);
// When using proxy, requests go through api.vercel.com (with x-vercel-workflow-api-url header if override is set)
// When not using proxy, use the default workflow-server URL (with /api path appended)
const baseUrl = usingProxy ? defaultProxyUrl : `${defaultHost}/api`;
const baseUrl = usingProxy
? customProxyUrl || defaultProxyUrl
: `${defaultHost}/api`;
return { baseUrl, usingProxy };
};

Expand Down
Loading