more env stuff
This commit is contained in:
19
src/lib/config.ts
Normal file
19
src/lib/config.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { createServerFn } from '@tanstack/react-start'
|
||||
|
||||
export const getConfig = createServerFn({ method: 'GET' }).handler(async () => {
|
||||
return {
|
||||
apiDomain: process.env.VITE_API_DOMAIN || 'http://localhost:3000',
|
||||
websiteDomain: process.env.VITE_WEBSITE_DOMAIN || 'http://localhost:3000',
|
||||
spotifyClientId: process.env.VITE_SPOTIFY_CLIENT_ID || '',
|
||||
spotifyRedirectUri: process.env.VITE_SPOTIFY_REDIRECT_URI || '',
|
||||
}
|
||||
})
|
||||
|
||||
export const serverConfig = {
|
||||
apiDomain: process.env.VITE_API_DOMAIN || 'http://localhost:3000',
|
||||
websiteDomain: process.env.VITE_WEBSITE_DOMAIN || 'http://localhost:3000',
|
||||
supertokensUri: process.env.SUPERTOKENS_URI || 'http://localhost:3567',
|
||||
pocketbaseUrl: process.env.POCKETBASE_URL || 'http://localhost:8090',
|
||||
spotifyClientId: process.env.VITE_SPOTIFY_CLIENT_ID || '',
|
||||
spotifyClientSecret: process.env.SPOTIFY_CLIENT_SECRET || '',
|
||||
}
|
||||
@@ -1,7 +1,14 @@
|
||||
const getOrigin = (): string => {
|
||||
if (typeof window !== 'undefined') {
|
||||
return window.location.origin;
|
||||
}
|
||||
return process.env.VITE_API_DOMAIN || 'http://localhost:3000';
|
||||
};
|
||||
|
||||
export const appInfo = {
|
||||
appName: 'FLXN',
|
||||
apiDomain: process.env.VITE_API_DOMAIN || 'http://localhost:3000',
|
||||
websiteDomain: process.env.VITE_WEBSITE_DOMAIN || 'http://localhost:3000',
|
||||
apiDomain: getOrigin(),
|
||||
websiteDomain: getOrigin(),
|
||||
apiBasePath: '/api/auth',
|
||||
websiteBasePath: '/auth',
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user