In production mode, embed static content
This commit is contained in:
parent
0876fc3c2e
commit
deb4ff03ca
9
main.go
9
main.go
@ -5,7 +5,6 @@ import (
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
var mux = http.NewServeMux()
|
||||
@ -55,12 +54,8 @@ func main() {
|
||||
log.Println("Registering handlers...")
|
||||
authFunc := func(r *http.Request) *User { return Authenticate(*htpasswd, r) }
|
||||
|
||||
staticDir, _ := filepath.Abs("static")
|
||||
if _, err := os.Stat(staticDir); os.IsNotExist(err) {
|
||||
staticDir, _ = filepath.Abs(filepath.Join(filepath.Dir(os.Args[0]), "static"))
|
||||
if _, err := os.Stat(staticDir); os.IsNotExist(err) {
|
||||
log.Fatal(err)
|
||||
}
|
||||
if err := sanitizeStaticOptions(); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||
|
Loading…
Reference in New Issue
Block a user