Open sammcj opened 6 months ago
Yes you're right. We should use env vars for this. But to be honest, we should not use vite in the first place to run the production / release version.
I think we should package the whole thing and run it either as a static site or via nodejs. https://kit.svelte.dev/docs/adapters.
oh yea and the switch to an .env file really is a good idea :)
I will add the backend env var next. But i dont think we should use the vite proxy solution in the future. Its kinda hard to provide a one click solution and sensible defaults for people like you who have proper routing and networking setup in their env / prod.
But i also plan to run this on my Kubernetes cluster using traefik, so we will definitely find a nice solution for this.
I was about to open an issue asking to make the backend URI configurable via an env var. That allows for more complex setups that don't have to rely on docker alone (packaging for other distributions).
Anyone here knows how to get vite to read env vars?
I was trying to figure out why the frontend wouldn't connect to my backend container and found that the container names appear to be hard coded.
For example if I understand https://github.com/nilsherzig/LLocalSearch/blob/main/vite.config.ts#L9 correctly this assumes the backend container is always going to exist at http://backend:8080 - which won't work if your backend container is named something else, e.g. in my case llocalsearch-backend and may be behind a traefik load balancer so could be something like https://llocalsearch-backend.my.domain:443