marcopeocchi / yt-dlp-web-ui

A terrible web ui for yt-dlp. Designed to be self-hosted.
Mozilla Public License 2.0
657 stars 67 forks source link

Kubernetes ingress baseURL #157

Open mihaigalos opened 2 weeks ago

mihaigalos commented 2 weeks ago

I would like to let this run in a Kubernetes environment. I've already written the chart for it and can contribute when fully operational.

I however am missing an app-side configuration which would allow me to serve content from a specified path. A change would be required here:

-r.Mount("/", http.FileServer(http.FS(c.frontend)))
+r.Mount(baseURL + "/", http.FileServer(http.FS(c.frontend)))

This is the standard way of handling prefixing in other major apps (Prometheus, Grafana) and could be consumed though a config.yml parameter.

I know you're refactoring the repo which is why I'm not contributing a PR. Also, I cannot build from source with 7ea1c0b205d258c0833e1fe4ead7dbfce8342c0b, but would love to contribute otherwise:

$ go build ./...
main.go:37:13: pattern frontend/dist/assets/*: no matching files found
marcopeocchi commented 2 weeks ago

Whilst I'll try to set up a local kubernetes cluster I've changed some code according to your requirements:

-r.Mount("/", http.FileServer(http.FS(c.frontend)))
+baseUrl := config.Instance().BaseURL
+r.Mount(baseUrl+"/", http.StripPrefix(baseUrl, http.FileServerFS(c.frontend)))

the BaseURL is configurable through the config.yml file with the base_url key:

...
base_url: "/hello"
...