router_static.go: use a prefix variable
This commit is contained in:
parent
dec05be7f8
commit
7e9713b35e
@ -42,13 +42,13 @@ func initStaticRouter(router *mux.Router) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
prefix := ""
|
||||||
if dir == "js" {
|
if dir == "js" {
|
||||||
asset[path] = "window.origin='" + os.Getenv("ORIGIN") + "';" + string(contents)
|
prefix = "window.origin='" + os.Getenv("ORIGIN") + "';"
|
||||||
} else {
|
|
||||||
asset[path] = string(contents)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.Debugf("routing %s", path)
|
asset[p] = prefix + string(contents);
|
||||||
|
|
||||||
router.HandleFunc(path, func(w http.ResponseWriter, r *http.Request) {
|
router.HandleFunc(path, func(w http.ResponseWriter, r *http.Request) {
|
||||||
fmt.Fprint(w, asset[r.URL.Path])
|
fmt.Fprint(w, asset[r.URL.Path])
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user