mirror of
https://github.com/formbricks/formbricks.git
synced 2026-03-13 11:09:29 -05:00
24 lines
561 B
TypeScript
24 lines
561 B
TypeScript
import "server-only";
|
|
import { env } from "./env";
|
|
|
|
const configuredWebappUrl = env.WEBAPP_URL?.trim() ?? "";
|
|
const WEBAPP_URL = (() => {
|
|
if (configuredWebappUrl !== "") {
|
|
return configuredWebappUrl;
|
|
}
|
|
|
|
if (env.VERCEL_URL) {
|
|
return `https://${env.VERCEL_URL}`;
|
|
}
|
|
|
|
return "http://localhost:3000";
|
|
})();
|
|
|
|
/**
|
|
* Returns the public domain URL
|
|
* Uses PUBLIC_URL if set, otherwise falls back to WEBAPP_URL
|
|
*/
|
|
export const getPublicDomain = (): string => {
|
|
return env.PUBLIC_URL && env.PUBLIC_URL.trim() !== "" ? env.PUBLIC_URL : WEBAPP_URL;
|
|
};
|