diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/deploy/components/deploy-modal/components/chat/chat.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/deploy/components/deploy-modal/components/chat/chat.tsx index c150ad3ab6..e254c7ce1c 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/deploy/components/deploy-modal/components/chat/chat.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/deploy/components/deploy-modal/components/chat/chat.tsx @@ -23,7 +23,7 @@ import { Alert, AlertDescription, Skeleton } from '@/components/ui' import { getEnv, isTruthy } from '@/lib/core/config/env' import { generatePassword } from '@/lib/core/security/encryption' import { cn } from '@/lib/core/utils/cn' -import { getEmailDomain } from '@/lib/core/utils/urls' +import { getBaseUrl, getEmailDomain } from '@/lib/core/utils/urls' import { quickValidateEmail } from '@/lib/messaging/email/validation' import { OutputSelect } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/chat/components/output-select/output-select' import { @@ -493,7 +493,7 @@ function IdentifierInput({ onChange(lowercaseValue) } - const fullUrl = `${getEnv('NEXT_PUBLIC_APP_URL')}/chat/${value}` + const fullUrl = `${getBaseUrl()}/chat/${value}` const displayUrl = fullUrl.replace(/^https?:\/\//, '') return ( diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/deploy/components/deploy-modal/components/form/form.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/deploy/components/deploy-modal/components/form/form.tsx index 614950c91f..3f0fd9ea50 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/deploy/components/deploy-modal/components/form/form.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/deploy/components/deploy-modal/components/form/form.tsx @@ -14,7 +14,6 @@ import { Tooltip, } from '@/components/emcn' import { Skeleton } from '@/components/ui' -import { getEnv } from '@/lib/core/config/env' import { isDev } from '@/lib/core/config/feature-flags' import { cn } from '@/lib/core/utils/cn' import { getBaseUrl, getEmailDomain } from '@/lib/core/utils/urls' @@ -392,7 +391,7 @@ export function FormDeploy({ ) } - const fullUrl = `${getEnv('NEXT_PUBLIC_APP_URL')}/form/${identifier}` + const fullUrl = `${getBaseUrl()}/form/${identifier}` const displayUrl = fullUrl.replace(/^https?:\/\//, '') return ( diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/deploy/components/deploy-modal/deploy-modal.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/deploy/components/deploy-modal/deploy-modal.tsx index 1ca73f5fb3..38d3d10651 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/deploy/components/deploy-modal/deploy-modal.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/deploy/components/deploy-modal/deploy-modal.tsx @@ -15,7 +15,7 @@ import { ModalTabsList, ModalTabsTrigger, } from '@/components/emcn' -import { getEnv } from '@/lib/core/config/env' +import { getBaseUrl } from '@/lib/core/utils/urls' import { getInputFormatExample as getInputFormatExampleUtil } from '@/lib/workflows/operations/deployment-utils' import type { WorkflowDeploymentVersionResponse } from '@/lib/workflows/persistence/utils' import { useUserPermissionsContext } from '@/app/workspace/[workspaceId]/providers/workspace-permissions-provider' @@ -209,7 +209,7 @@ export function DeployModal({ } const data = await response.json() - const endpoint = `${getEnv('NEXT_PUBLIC_APP_URL')}/api/workflows/${workflowId}/execute` + const endpoint = `${getBaseUrl()}/api/workflows/${workflowId}/execute` const inputFormatExample = getInputFormatExample(selectedStreamingOutputs.length > 0) const placeholderKey = workflowWorkspaceId ? 'YOUR_WORKSPACE_API_KEY' : 'YOUR_API_KEY' @@ -270,7 +270,7 @@ export function DeployModal({ const deploymentInfoResponse = await fetch(`/api/workflows/${workflowId}/deploy`) if (deploymentInfoResponse.ok) { const deploymentData = await deploymentInfoResponse.json() - const apiEndpoint = `${getEnv('NEXT_PUBLIC_APP_URL')}/api/workflows/${workflowId}/execute` + const apiEndpoint = `${getBaseUrl()}/api/workflows/${workflowId}/execute` const inputFormatExample = getInputFormatExample(selectedStreamingOutputs.length > 0) const placeholderKey = getApiHeaderPlaceholder() @@ -409,7 +409,7 @@ export function DeployModal({ const deploymentInfoResponse = await fetch(`/api/workflows/${workflowId}/deploy`) if (deploymentInfoResponse.ok) { const deploymentData = await deploymentInfoResponse.json() - const apiEndpoint = `${getEnv('NEXT_PUBLIC_APP_URL')}/api/workflows/${workflowId}/execute` + const apiEndpoint = `${getBaseUrl()}/api/workflows/${workflowId}/execute` const inputFormatExample = getInputFormatExample(selectedStreamingOutputs.length > 0) const placeholderKey = getApiHeaderPlaceholder() @@ -526,7 +526,7 @@ export function DeployModal({ const deploymentInfoResponse = await fetch(`/api/workflows/${workflowId}/deploy`) if (deploymentInfoResponse.ok) { const deploymentData = await deploymentInfoResponse.json() - const apiEndpoint = `${getEnv('NEXT_PUBLIC_APP_URL')}/api/workflows/${workflowId}/execute` + const apiEndpoint = `${getBaseUrl()}/api/workflows/${workflowId}/execute` const inputFormatExample = getInputFormatExample(selectedStreamingOutputs.length > 0) const placeholderKey = getApiHeaderPlaceholder() diff --git a/apps/sim/lib/core/config/feature-flags.ts b/apps/sim/lib/core/config/feature-flags.ts index 2a57e569da..8b8bf75411 100644 --- a/apps/sim/lib/core/config/feature-flags.ts +++ b/apps/sim/lib/core/config/feature-flags.ts @@ -1,7 +1,7 @@ /** * Environment utility functions for consistent environment detection across the application */ -import { env, isFalsy, isTruthy } from './env' +import { env, getEnv, isFalsy, isTruthy } from './env' /** * Is the application running in production mode @@ -21,7 +21,9 @@ export const isTest = env.NODE_ENV === 'test' /** * Is this the hosted version of the application */ -export const isHosted = true +export const isHosted = + getEnv('NEXT_PUBLIC_APP_URL') === 'https://www.sim.ai' || + getEnv('NEXT_PUBLIC_APP_URL') === 'https://www.staging.sim.ai' /** * Is billing enforcement enabled