🐛 Improve parse runtime env reading function

This commit is contained in:
Baptiste Arnaud
2023-08-28 14:19:40 +02:00
parent efd4600b7e
commit 036b407a11
8 changed files with 22 additions and 20 deletions

View File

@@ -1,8 +1,8 @@
import { env } from '@typebot.io/env'
import { getRuntimeVariable } from '@typebot.io/env/getRuntimeVariable'
const cloudViewerUrl = 'https://viewer.typebot.io'
export const guessApiHost = () =>
env.NEXT_PUBLIC_VIEWER_INTERNAL_URL ??
env.NEXT_PUBLIC_VIEWER_URL[0] ??
getRuntimeVariable('NEXT_PUBLIC_VIEWER_INTERNAL_URL') ??
getRuntimeVariable('NEXT_PUBLIC_VIEWER_URL')?.split(',')[0] ??
cloudViewerUrl