()
| 75 | * @returns The domain with port if applicable (e.g., 'localhost:3000' or 'sim.ai') |
| 76 | */ |
| 77 | export function getBaseDomain(): string { |
| 78 | try { |
| 79 | const url = new URL(getBaseUrl()) |
| 80 | return url.host // host includes port if specified |
| 81 | } catch (_e) { |
| 82 | const fallbackUrl = getEnv('NEXT_PUBLIC_APP_URL') || 'http://localhost:3000' |
| 83 | try { |
| 84 | return new URL(fallbackUrl).host |
| 85 | } catch { |
| 86 | return isProd ? 'sim.ai' : 'localhost:3000' |
| 87 | } |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | /** |
| 92 | * Returns the domain for email addresses, stripping www subdomain for Resend compatibility |
no test coverage detected