Compare commits

..

4 Commits

Author SHA1 Message Date
9376944373 remove junk accidentally committed to Dockerfile
All checks were successful
continuous-integration/drone/push Build is passing
2020-04-04 18:42:41 -07:00
39213020e2 instance handler tweaks
Some checks failed
continuous-integration/drone/push Build is failing
2020-04-04 18:40:34 -07:00
9234e883e6 factor out 404 handler so all 404s are the same
Some checks failed
continuous-integration/drone/push Build is failing
2020-04-04 18:37:30 -07:00
98861bc6f3 builds now, not sure if the new handler works or not
Some checks failed
continuous-integration/drone/push Build is failing
2020-04-04 18:32:25 -07:00
2 changed files with 17 additions and 13 deletions

View File

@@ -14,15 +14,6 @@ RUN tar cfz go-src.tgz src && du -sh *
FROM alpine FROM alpine
54 viper.SetDefault("Debug", false)
55 viper.SetDefault("TootsToDisk", false)
56 viper.SetDefault("TootsToDB", true)
57 viper.SetDefault("HostDiscoveryParallelism", 5)
58 viper.SetDefault("FSStorageLocation", os.ExpandEnv("$HOME/Library/ApplicationSupport/feta/tootarchive.d"))
59 viper.SetDefault("DBStorageLocation", os.ExpandEnv("$HOME/Library/ApplicationSupport/feta/feta.state.db"))
60 viper.SetDefault("LogReportInterval", time.Second*10)
# here are the levers # here are the levers
ENV FETA_HOSTDISCOVERYPARALLELISM 20 ENV FETA_HOSTDISCOVERYPARALLELISM 20
ENV FETA_FSSTORAGELOCATION /state/tootstore ENV FETA_FSSTORAGELOCATION /state/tootstore

View File

@@ -10,6 +10,7 @@ import (
u "git.eeqj.de/sneak/goutil" u "git.eeqj.de/sneak/goutil"
"github.com/flosch/pongo2" "github.com/flosch/pongo2"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/google/uuid"
"github.com/labstack/echo" "github.com/labstack/echo"
) )
@@ -87,17 +88,29 @@ func (a *Server) getInstanceListHandler() http.HandlerFunc {
} }
*/ */
func (a *Server) notFoundHandler(c echo.Context) error {
return c.String(http.StatusNotFound, "404 not found")
}
func (a *Server) instanceHandler(c echo.Context) error { func (a *Server) instanceHandler(c echo.Context) error {
tu := c.Param("uuid") tu := c.Param("uuid")
u, err := uuid.Parse(tu) u, err := uuid.Parse(tu)
if err != nil { if err != nil {
return c.String(http.StatusNotFound, "404 not found") return a.notFoundHandler(c)
} }
tc := pongo2.Context{}
instances := a.feta.manager.ListInstances()
found := false
for _, item := range instances {
if item.UUID == u {
tc["instance"] = item
found = true
}
}
i := a.feta.manager.ListInstances() { if !found {
tc := pongo2.Context{ return a.notFoundHandler(c)
"instance": i,
} }
return c.Render(http.StatusOK, "instance.html", tc) return c.Render(http.StatusOK, "instance.html", tc)