feat(server): insert the mod path

This commit is contained in:
Brandon Philips
2013-10-16 18:59:25 -07:00
parent 56bbab74ca
commit 5620f88635
3 changed files with 17 additions and 4 deletions

View File

@ -7,10 +7,12 @@ import (
"path"
"time"
"github.com/coreos/etcd/log"
"github.com/coreos/etcd/mod/dashboard/resources"
)
func memoryFileServer(w http.ResponseWriter, req *http.Request) {
log.Debugf("[recv] %s %s [%s]", req.Method, req.URL.Path, req.RemoteAddr)
upath := req.URL.Path
if len(upath) == 0 {
upath = "index.html"
@ -42,6 +44,7 @@ func HttpHandler() (handler http.Handler) {
// Serve the dashboard from a filesystem if the magic env variable is enabled
dashDir := os.Getenv("ETCD_DASHBOARD_DIR")
if len(dashDir) != 0 {
log.Debugf("Using dashboard directory %s", dashDir)
handler = http.FileServer(http.Dir(dashDir))
}