2023-06-09 18:21:18 +10:00
|
|
|
/* eslint-disable turbo/no-undeclared-env-vars */
|
2024-01-31 22:32:42 +11:00
|
|
|
import { NEXT_PUBLIC_WEBAPP_URL } from '../constants/app';
|
2024-01-25 10:48:20 +02:00
|
|
|
|
2023-06-09 18:21:18 +10:00
|
|
|
export const getBaseUrl = () => {
|
|
|
|
|
if (typeof window !== 'undefined') {
|
|
|
|
|
return '';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (process.env.VERCEL_URL) {
|
|
|
|
|
return `https://${process.env.VERCEL_URL}`;
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-31 22:32:42 +11:00
|
|
|
const webAppUrl = NEXT_PUBLIC_WEBAPP_URL();
|
|
|
|
|
|
|
|
|
|
if (webAppUrl) {
|
|
|
|
|
return webAppUrl;
|
2023-06-09 18:21:18 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return `http://localhost:${process.env.PORT ?? 3000}`;
|
|
|
|
|
};
|