Skip to content

Commit a247646

Browse files
committed
fix(feature-flags): simplify isHosted subdomain check
1 parent 6145446 commit a247646

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

apps/sim/lib/core/config/feature-flags.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,9 @@ export const isTest = env.NODE_ENV === 'test'
2222
* Is this the hosted version of the application.
2323
* True for sim.ai and any subdomain of sim.ai (e.g. staging.sim.ai, dev.sim.ai).
2424
*/
25-
export const isHosted = (() => {
26-
try {
27-
const hostname = new URL(getEnv('NEXT_PUBLIC_APP_URL') || '').hostname
28-
return hostname === 'sim.ai' || hostname.endsWith('.sim.ai')
29-
} catch {
30-
return false
31-
}
32-
})()
25+
const appUrl = getEnv('NEXT_PUBLIC_APP_URL')
26+
const appHostname = appUrl ? new URL(appUrl).hostname : ''
27+
export const isHosted = appHostname === 'sim.ai' || appHostname.endsWith('.sim.ai')
3328

3429
/**
3530
* Is billing enforcement enabled

0 commit comments

Comments
 (0)