mirror of
https://github.com/simstudioai/sim.git
synced 2026-04-06 03:00:16 -04:00
fix(envvars): use getEnv for isHosted check since it is client-side (#1461)
This commit is contained in:
@@ -66,10 +66,11 @@ describe('Workspace Invitation [invitationId] API Route', () => {
|
||||
NEXT_PUBLIC_APP_URL: 'https://test.sim.ai',
|
||||
BILLING_ENABLED: false,
|
||||
},
|
||||
isTruthy: (value: any) =>
|
||||
isTruthy: (value: string | boolean | number | undefined) =>
|
||||
typeof value === 'string'
|
||||
? value.toLowerCase() === 'true' || value === '1'
|
||||
: Boolean(value),
|
||||
getEnv: (variable: string) => process.env[variable],
|
||||
}))
|
||||
|
||||
mockTransaction = vi.fn()
|
||||
@@ -388,10 +389,11 @@ describe('Workspace Invitation [invitationId] API Route', () => {
|
||||
NEXT_PUBLIC_APP_URL: 'https://test.sim.ai',
|
||||
BILLING_ENABLED: false,
|
||||
},
|
||||
isTruthy: (value: any) =>
|
||||
isTruthy: (value: string | boolean | number | undefined) =>
|
||||
typeof value === 'string'
|
||||
? value.toLowerCase() === 'true' || value === '1'
|
||||
: Boolean(value),
|
||||
getEnv: (variable: string) => process.env[variable],
|
||||
}))
|
||||
vi.doMock('@sim/db/schema', () => ({
|
||||
workspaceInvitation: { id: 'id' },
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Environment utility functions for consistent environment detection across the application
|
||||
*/
|
||||
import { env, isTruthy } from './env'
|
||||
import { env, getEnv, isTruthy } from './env'
|
||||
|
||||
/**
|
||||
* Is the application running in production mode
|
||||
@@ -22,8 +22,8 @@ export const isTest = env.NODE_ENV === 'test'
|
||||
* Is this the hosted version of the application
|
||||
*/
|
||||
export const isHosted =
|
||||
env.NEXT_PUBLIC_APP_URL === 'https://www.sim.ai' ||
|
||||
env.NEXT_PUBLIC_APP_URL === 'https://www.staging.sim.ai'
|
||||
getEnv('NEXT_PUBLIC_APP_URL') === 'https://www.sim.ai' ||
|
||||
getEnv('NEXT_PUBLIC_APP_URL') === 'https://www.staging.sim.ai'
|
||||
|
||||
/**
|
||||
* Is billing enforcement enabled
|
||||
|
||||
Reference in New Issue
Block a user