diff --git a/main.go b/main.go index 08c5302..51b54f8 100644 --- a/main.go +++ b/main.go @@ -3,6 +3,7 @@ package main import ( "context" "net/http" + "os" "github.com/go-chi/chi/v5" "gitlab.com/zephyrtronium/sq" @@ -14,6 +15,11 @@ import ( _ "modernc.org/sqlite" ) +var ( + addr = os.Getenv("SHOTGUN_HTTP") + public = os.Getenv("SHOTGUN_PUBLIC") +) + func main() { sessiondb, err := sq.Open("sqlite", ":memory:") if err != nil { @@ -40,5 +46,6 @@ func main() { r.Post("/user/login", s.Login) r.With(serve.WithSession(sessions)).Get("/user/me", s.Me) r.With(serve.WithSession(sessions)).Get("/queue", s.Queue) - http.ListenAndServe(":8080", r) + r.Method("GET", "/", http.FileServer(http.Dir(public))) + http.ListenAndServe(addr, r) }