From 09e1fcaa35ae5b159a3035dcd0b8796b2eaf847c Mon Sep 17 00:00:00 2001 From: Meder Kamalov Date: Fri, 16 Feb 2024 15:13:25 +0100 Subject: [PATCH] misc: enable setting baseUrl for functions --- libs/client/src/function.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libs/client/src/function.ts b/libs/client/src/function.ts index f354ba6..8924739 100644 --- a/libs/client/src/function.ts +++ b/libs/client/src/function.ts @@ -42,6 +42,11 @@ type ExtraOptions = { * influences how the URL is built. */ readonly subdomain?: string; + + /** + * If set, the function will call provided baseUrl. + */ + readonly baseUrl?: string; }; /** @@ -80,7 +85,8 @@ export function buildUrl( const appId = ensureAppIdFormat(id); const subdomain = options.subdomain ? `${options.subdomain}.` : ''; - const url = `https://${subdomain}fal.run/${appId}/${path}`; + const baseUrl = options.baseUrl || "fal.run" + const url = `https://${subdomain}${baseUrl}/${appId}/${path}`; return `${url.replace(/\/$/, '')}${queryParams}`; }