MCPcopy
hub / github.com/simstudioai/sim / getBaseDomain

Function getBaseDomain

apps/sim/lib/core/utils/urls.ts:77–89  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

75 * @returns The domain with port if applicable (e.g., 'localhost:3000' or 'sim.ai')
76 */
77export 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

Callers 2

sendToProfoundFunction · 0.90
getEmailDomainFunction · 0.85

Calls 2

getEnvFunction · 0.90
getBaseUrlFunction · 0.70

Tested by

no test coverage detected