conf: new Web>ExternalWebroot key to load from /client/ directory
This commit is contained in:
parent
656125e790
commit
d5e8e051e3
@ -12,6 +12,8 @@ type Config struct {
|
|||||||
BindTo string `json:"bind_to"`
|
BindTo string `json:"bind_to"`
|
||||||
Extern string `json:"extern"`
|
Extern string `json:"extern"`
|
||||||
Title string `json:"title"`
|
Title string `json:"title"`
|
||||||
|
|
||||||
|
ExternalWebroot bool `json:"external_webroot,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
Hub struct {
|
Hub struct {
|
||||||
|
4
main.go
4
main.go
@ -229,7 +229,11 @@ func (this *App) RunServer() {
|
|||||||
http.HandleFunc("/conf", this.ConfigRequestHandler)
|
http.HandleFunc("/conf", this.ConfigRequestHandler)
|
||||||
|
|
||||||
// Other files: asset handler
|
// Other files: asset handler
|
||||||
|
if this.cfg.Web.ExternalWebroot {
|
||||||
|
http.Handle("/", http.FileServer(http.Dir("client")))
|
||||||
|
} else {
|
||||||
http.HandleFunc("/", this.StaticRequestHandler)
|
http.HandleFunc("/", this.StaticRequestHandler)
|
||||||
|
}
|
||||||
|
|
||||||
// Listen and serve
|
// Listen and serve
|
||||||
bindAddr := fmt.Sprintf("%s:%d", this.cfg.Web.BindTo, this.cfg.Web.Port)
|
bindAddr := fmt.Sprintf("%s:%d", this.cfg.Web.BindTo, this.cfg.Web.Port)
|
||||||
|
Loading…
Reference in New Issue
Block a user