Fix session setup

This commit is contained in:
Marcos Lilljedahl
2019-04-23 11:23:33 -03:00
parent 172be6edf7
commit b758b005e9
2 changed files with 14 additions and 1 deletions

View File

@@ -13,7 +13,7 @@ func SessionSetup(rw http.ResponseWriter, req *http.Request) {
vars := mux.Vars(req)
sessionId := vars["sessionId"]
body := pwd.SessionSetupConf{PlaygroundFQDN: req.Host}
body := pwd.SessionSetupConf{PlaygroundFQDN: req.Host, DindVolumeSize: "5G"}
json.NewDecoder(req.Body).Decode(&body)
@@ -23,6 +23,17 @@ func SessionSetup(rw http.ResponseWriter, req *http.Request) {
return
}
playground := core.PlaygroundGet(s.PlaygroundId)
if playground == nil {
log.Printf("Playground with id %s for session %s was not found!", s.PlaygroundId, s.Id)
rw.WriteHeader(http.StatusBadRequest)
return
}
if len(playground.DindVolumeSize) > 0 {
body.DindVolumeSize = playground.DindVolumeSize
}
err = core.SessionSetup(s, body)
if err != nil {
if pwd.SessionNotEmpty(err) {