File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ export const ConfigContext = createContext<Config>({
2323export const useConfig = ( ) => useContext ( ConfigContext ) ;
2424export const ConfigProvider = ConfigContext . Provider ;
2525
26- const getApiEndpoint = ( apiEndpoint : string ) => {
26+ export const getApiEndpoint = ( apiEndpoint : string ) => {
2727 if ( apiEndpoint === "__AUTO__" ) {
2828 if ( location . hostname . startsWith ( "hub." ) ) {
2929 // Connect to the corresponding API endpoint
Original file line number Diff line number Diff line change 11import z from "zod" ;
2+ import { getApiEndpoint } from "../components/lib/config" ;
23
34export const commonEnvSchema = z . object ( {
4- VITE_APP_API_URL : z . string ( ) ,
5+ VITE_APP_API_URL : z . string ( ) . transform ( ( url ) => {
6+ return getApiEndpoint ( url ) ;
7+ } ) ,
58 VITE_APP_ASSETS_URL : z . string ( ) . url ( ) ,
69 VITE_APP_POSTHOG_API_KEY : z . string ( ) . optional ( ) ,
710 VITE_APP_POSTHOG_API_HOST : z . string ( ) . url ( ) . optional ( ) ,
@@ -19,7 +22,9 @@ export const engineEnv = () => commonEnvSchema.parse(import.meta.env);
1922
2023export const cloudEnvSchema = commonEnvSchema . merge (
2124 z . object ( {
22- VITE_APP_API_URL : z . string ( ) . url ( ) ,
25+ VITE_APP_API_URL : z . string ( ) . transform ( ( url ) => {
26+ return getApiEndpoint ( url ) ;
27+ } ) ,
2328 VITE_APP_CLOUD_ENGINE_URL : z . string ( ) . url ( ) ,
2429 VITE_APP_CLOUD_API_URL : z . string ( ) . url ( ) ,
2530 VITE_APP_CLERK_PUBLISHABLE_KEY : z . string ( ) ,
You can’t perform that action at this time.
0 commit comments