Skip to content

Commit 048eddd

Browse files
authored
fix(ff): add back condition for isHosted FF (#2789)
* fix(ff): add back condition for isHosted FF * updated callers to use getBaseUrl()
1 parent 6717ce8 commit 048eddd

File tree

4 files changed

+12
-11
lines changed

4 files changed

+12
-11
lines changed

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/deploy/components/deploy-modal/components/chat/chat.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import { Alert, AlertDescription, Skeleton } from '@/components/ui'
2323
import { getEnv, isTruthy } from '@/lib/core/config/env'
2424
import { generatePassword } from '@/lib/core/security/encryption'
2525
import { cn } from '@/lib/core/utils/cn'
26-
import { getEmailDomain } from '@/lib/core/utils/urls'
26+
import { getBaseUrl, getEmailDomain } from '@/lib/core/utils/urls'
2727
import { quickValidateEmail } from '@/lib/messaging/email/validation'
2828
import { OutputSelect } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/chat/components/output-select/output-select'
2929
import {
@@ -493,7 +493,7 @@ function IdentifierInput({
493493
onChange(lowercaseValue)
494494
}
495495

496-
const fullUrl = `${getEnv('NEXT_PUBLIC_APP_URL')}/chat/${value}`
496+
const fullUrl = `${getBaseUrl()}/chat/${value}`
497497
const displayUrl = fullUrl.replace(/^https?:\/\//, '')
498498

499499
return (

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/deploy/components/deploy-modal/components/form/form.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import {
1414
Tooltip,
1515
} from '@/components/emcn'
1616
import { Skeleton } from '@/components/ui'
17-
import { getEnv } from '@/lib/core/config/env'
1817
import { isDev } from '@/lib/core/config/feature-flags'
1918
import { cn } from '@/lib/core/utils/cn'
2019
import { getBaseUrl, getEmailDomain } from '@/lib/core/utils/urls'
@@ -392,7 +391,7 @@ export function FormDeploy({
392391
)
393392
}
394393

395-
const fullUrl = `${getEnv('NEXT_PUBLIC_APP_URL')}/form/${identifier}`
394+
const fullUrl = `${getBaseUrl()}/form/${identifier}`
396395
const displayUrl = fullUrl.replace(/^https?:\/\//, '')
397396

398397
return (

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/deploy/components/deploy-modal/deploy-modal.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
ModalTabsList,
1616
ModalTabsTrigger,
1717
} from '@/components/emcn'
18-
import { getEnv } from '@/lib/core/config/env'
18+
import { getBaseUrl } from '@/lib/core/utils/urls'
1919
import { getInputFormatExample as getInputFormatExampleUtil } from '@/lib/workflows/operations/deployment-utils'
2020
import type { WorkflowDeploymentVersionResponse } from '@/lib/workflows/persistence/utils'
2121
import { useUserPermissionsContext } from '@/app/workspace/[workspaceId]/providers/workspace-permissions-provider'
@@ -209,7 +209,7 @@ export function DeployModal({
209209
}
210210

211211
const data = await response.json()
212-
const endpoint = `${getEnv('NEXT_PUBLIC_APP_URL')}/api/workflows/${workflowId}/execute`
212+
const endpoint = `${getBaseUrl()}/api/workflows/${workflowId}/execute`
213213
const inputFormatExample = getInputFormatExample(selectedStreamingOutputs.length > 0)
214214
const placeholderKey = workflowWorkspaceId ? 'YOUR_WORKSPACE_API_KEY' : 'YOUR_API_KEY'
215215

@@ -270,7 +270,7 @@ export function DeployModal({
270270
const deploymentInfoResponse = await fetch(`/api/workflows/${workflowId}/deploy`)
271271
if (deploymentInfoResponse.ok) {
272272
const deploymentData = await deploymentInfoResponse.json()
273-
const apiEndpoint = `${getEnv('NEXT_PUBLIC_APP_URL')}/api/workflows/${workflowId}/execute`
273+
const apiEndpoint = `${getBaseUrl()}/api/workflows/${workflowId}/execute`
274274
const inputFormatExample = getInputFormatExample(selectedStreamingOutputs.length > 0)
275275
const placeholderKey = getApiHeaderPlaceholder()
276276

@@ -409,7 +409,7 @@ export function DeployModal({
409409
const deploymentInfoResponse = await fetch(`/api/workflows/${workflowId}/deploy`)
410410
if (deploymentInfoResponse.ok) {
411411
const deploymentData = await deploymentInfoResponse.json()
412-
const apiEndpoint = `${getEnv('NEXT_PUBLIC_APP_URL')}/api/workflows/${workflowId}/execute`
412+
const apiEndpoint = `${getBaseUrl()}/api/workflows/${workflowId}/execute`
413413
const inputFormatExample = getInputFormatExample(selectedStreamingOutputs.length > 0)
414414
const placeholderKey = getApiHeaderPlaceholder()
415415

@@ -526,7 +526,7 @@ export function DeployModal({
526526
const deploymentInfoResponse = await fetch(`/api/workflows/${workflowId}/deploy`)
527527
if (deploymentInfoResponse.ok) {
528528
const deploymentData = await deploymentInfoResponse.json()
529-
const apiEndpoint = `${getEnv('NEXT_PUBLIC_APP_URL')}/api/workflows/${workflowId}/execute`
529+
const apiEndpoint = `${getBaseUrl()}/api/workflows/${workflowId}/execute`
530530
const inputFormatExample = getInputFormatExample(selectedStreamingOutputs.length > 0)
531531

532532
const placeholderKey = getApiHeaderPlaceholder()

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* Environment utility functions for consistent environment detection across the application
33
*/
4-
import { env, isFalsy, isTruthy } from './env'
4+
import { env, getEnv, isFalsy, isTruthy } from './env'
55

66
/**
77
* Is the application running in production mode
@@ -21,7 +21,9 @@ export const isTest = env.NODE_ENV === 'test'
2121
/**
2222
* Is this the hosted version of the application
2323
*/
24-
export const isHosted = true
24+
export const isHosted =
25+
getEnv('NEXT_PUBLIC_APP_URL') === 'https://www.sim.ai' ||
26+
getEnv('NEXT_PUBLIC_APP_URL') === 'https://www.staging.sim.ai'
2527

2628
/**
2729
* Is billing enforcement enabled

0 commit comments

Comments
 (0)