wip
This commit is contained in:
@@ -27,10 +27,12 @@ import (
|
||||
|
||||
//go:embed public/*
|
||||
var _staticFileDir embed.FS
|
||||
var staticFileDir = func() embed.FS {
|
||||
panic("if dev mode then return live")
|
||||
return _staticFileDir
|
||||
}
|
||||
var publicHandler = func() http.Handler {
|
||||
if os.Getenv("DEBUG") != "" {
|
||||
return http.FileServer(http.Dir("./http"))
|
||||
}
|
||||
return http.FileServer(http.FS(_staticFileDir))
|
||||
}()
|
||||
|
||||
func Main() {
|
||||
foo := flag.String("foo", "bal", "bal or reg")
|
||||
@@ -65,7 +67,7 @@ func Main() {
|
||||
if *httpOutput != "" {
|
||||
foo := func(w http.ResponseWriter, r *http.Request) {
|
||||
if !strings.HasPrefix(r.URL.Path, "/api") {
|
||||
http.FileServer(http.FS(staticFileDir)).ServeHTTP(w, r)
|
||||
publicHandler.ServeHTTP(w, r)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user