mirror of
https://github.com/utopia-os/utopia-ui.git
synced 2025-12-12 23:36:00 +00:00
feat(backend): make map URL configurable (#304)
* use api config everywhere, default to localhost, ignore .env file, provide .env.dist * fix lint * make mapUrl configurable --------- Co-authored-by: Anton Tranelis <31516529+antontranelis@users.noreply.github.com>
This commit is contained in:
parent
5c79633ea4
commit
6c7308ad38
@ -1,5 +1,7 @@
|
||||
VITE_OPEN_COLLECTIVE_API_KEY=your_key
|
||||
VITE_API_URL=http://localhost:8055/
|
||||
#VITE_API_URL=https://api.utopia-lab.org
|
||||
VITE_MAP_URL=http://local.development
|
||||
#VITE_MAP_URL=CURRENT_WINDOW_LOCATION
|
||||
VITE_VALIDATE_INVITE_FLOW_ID=01d61db0-25aa-4bfa-bc24-c6a8f208a455
|
||||
VITE_REDEEM_INVITE_FLOW_ID=cc80ec73-ecf5-4789-bee5-1127fb1a6ed4
|
||||
|
||||
@ -54,7 +54,7 @@ import { ModalContent } from './ModalContent'
|
||||
import { Landingpage } from './pages/Landingpage'
|
||||
import MapContainer from './pages/MapContainer'
|
||||
import { getBottomRoutes, routes } from './routes/sidebar'
|
||||
import { config } from '@/config'
|
||||
import { config } from './config'
|
||||
import { InviteApi } from './api/inviteApi'
|
||||
|
||||
const userApi = new UserApi()
|
||||
@ -82,7 +82,10 @@ function App() {
|
||||
|
||||
useEffect(() => {
|
||||
setPermissionsApiInstance(new permissionsApi())
|
||||
setMapApiInstance(new mapApi(window.location.origin))
|
||||
// TODO: it should be mapId instead of mapUrl, which then in turn can be an URL
|
||||
const mapUrl =
|
||||
config.mapUrl === 'CURRENT_WINDOW_LOCATION' ? window.location.origin : config.mapUrl
|
||||
setMapApiInstance(new mapApi(mapUrl))
|
||||
setAttestationApi(new itemsApi<any>('attestations'))
|
||||
}, [])
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
export const config = {
|
||||
apiUrl: String(import.meta.env.VITE_API_URL ?? 'http://localhost:8055/'),
|
||||
mapUrl: String(import.meta.env.VITE_MAP_URL ?? 'http://local.development'),
|
||||
validateInviteFlowId: String(
|
||||
import.meta.env.VITE_VALIDATE_INVITE_FLOW_ID ?? '01d61db0-25aa-4bfa-bc24-c6a8f208a455',
|
||||
),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user