Allow to disable windows instances
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"net/http"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/play-with-docker/play-with-docker/config"
|
||||
)
|
||||
|
||||
func Home(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -21,5 +22,9 @@ func Home(w http.ResponseWriter, r *http.Request) {
|
||||
go core.SessionDeployStack(s)
|
||||
}
|
||||
|
||||
http.ServeFile(w, r, "./www/index.html")
|
||||
if config.NoWindows {
|
||||
http.ServeFile(w, r, "./www/index-nw.html")
|
||||
} else {
|
||||
http.ServeFile(w, r, "./www/index.html")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"net/http"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/play-with-docker/play-with-docker/config"
|
||||
"github.com/play-with-docker/play-with-docker/provisioner"
|
||||
"github.com/play-with-docker/play-with-docker/pwd"
|
||||
"github.com/play-with-docker/play-with-docker/pwd/types"
|
||||
@@ -22,6 +23,11 @@ func NewInstance(rw http.ResponseWriter, req *http.Request) {
|
||||
|
||||
s := core.SessionGet(sessionId)
|
||||
|
||||
if body.Type == "windows" && config.NoWindows {
|
||||
rw.WriteHeader(http.StatusUnauthorized)
|
||||
return
|
||||
}
|
||||
|
||||
i, err := core.InstanceNew(s, body)
|
||||
if err != nil {
|
||||
if pwd.SessionComplete(err) {
|
||||
|
||||
Reference in New Issue
Block a user