Files
play-with-docker/handlers/home.go
Jonathan Leibiusky @xetorthio f9809028da Allow to disable windows instances
2017-10-02 17:19:24 -03:00

31 lines
627 B
Go

package handlers
import (
"net/http"
"github.com/gorilla/mux"
"github.com/play-with-docker/play-with-docker/config"
)
func Home(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
sessionId := vars["sessionId"]
s := core.SessionGet(sessionId)
if s == nil {
// Session doesn't exist (can happen if closing the sessions an reloading the page, or similar).
w.WriteHeader(http.StatusNotFound)
return
}
if s.Stack != "" {
s.Host = r.Host
go core.SessionDeployStack(s)
}
if config.NoWindows {
http.ServeFile(w, r, "./www/index-nw.html")
} else {
http.ServeFile(w, r, "./www/index.html")
}
}