mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 08:13:56 +10:00
21 lines
441 B
TypeScript
21 lines
441 B
TypeScript
/* eslint-disable turbo/no-undeclared-env-vars */
|
|
import { NEXT_PUBLIC_WEBAPP_URL } from '../constants/app';
|
|
|
|
export const getBaseUrl = () => {
|
|
if (typeof window !== 'undefined') {
|
|
return '';
|
|
}
|
|
|
|
if (process.env.VERCEL_URL) {
|
|
return `https://${process.env.VERCEL_URL}`;
|
|
}
|
|
|
|
const webAppUrl = NEXT_PUBLIC_WEBAPP_URL();
|
|
|
|
if (webAppUrl) {
|
|
return webAppUrl;
|
|
}
|
|
|
|
return `http://localhost:${process.env.PORT ?? 3000}`;
|
|
};
|