package ui import ( "fmt" "log" "net/http" "github.com/gin-gonic/gin" "git.jmbit.de/filegate/filegate/db" "git.jmbit.de/filegate/filegate/utils" "git.jmbit.de/filegate/filegate/web/templates" ) func getContainer(c *gin.Context) { id := c.Param("id") //TODO: save to session instead of hitting DB for this container, err := db.ContainerByFolder(id) port := container.Port if err != nil { log.Printf("could not get container from Folder UUID: %v", err) c.HTML(http.StatusNotFound, "", templates.Index(utils.GenMetaContent(c), err)) } targetURL := fmt.Sprintf("http://localhost:%d/", port) proxy, err := createReverseProxy(targetURL) if err != nil { log.Printf("could not get container from Folder UUID: %v", err) c.HTML(http.StatusNotFound, "", templates.Index(utils.GenMetaContent(c), err)) } proxy.ServeHTTP(c.Writer, c.Request) }