Files
documenso/packages/lib/universal/get-base-url.ts
Ephraim Atta-Duncan 3d7912586e fix: use APP_BASE_URL
2024-11-21 12:32:04 +00:00

21 lines
439 B
TypeScript

/* eslint-disable turbo/no-undeclared-env-vars */
import { APP_BASE_URL } from '../constants/app';
export const getBaseUrl = () => {
if (typeof window !== 'undefined') {
return '';
}
const marketingAppUrl = APP_BASE_URL();
if (marketingAppUrl) {
return marketingAppUrl;
}
if (process.env.VERCEL_URL) {
return `https://${process.env.VERCEL_URL}`;
}
return `http://localhost:${process.env.PORT ?? 3000}`;
};