Fix session setup
This commit is contained in:
@@ -13,7 +13,7 @@ func SessionSetup(rw http.ResponseWriter, req *http.Request) {
|
|||||||
vars := mux.Vars(req)
|
vars := mux.Vars(req)
|
||||||
sessionId := vars["sessionId"]
|
sessionId := vars["sessionId"]
|
||||||
|
|
||||||
body := pwd.SessionSetupConf{PlaygroundFQDN: req.Host}
|
body := pwd.SessionSetupConf{PlaygroundFQDN: req.Host, DindVolumeSize: "5G"}
|
||||||
|
|
||||||
json.NewDecoder(req.Body).Decode(&body)
|
json.NewDecoder(req.Body).Decode(&body)
|
||||||
|
|
||||||
@@ -23,6 +23,17 @@ func SessionSetup(rw http.ResponseWriter, req *http.Request) {
|
|||||||
return
|
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)
|
err = core.SessionSetup(s, body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if pwd.SessionNotEmpty(err) {
|
if pwd.SessionNotEmpty(err) {
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ func (s *sessionBuilderWriter) Write(p []byte) (n int, err error) {
|
|||||||
type SessionSetupConf struct {
|
type SessionSetupConf struct {
|
||||||
Instances []SessionSetupInstanceConf `json:"instances"`
|
Instances []SessionSetupInstanceConf `json:"instances"`
|
||||||
PlaygroundFQDN string
|
PlaygroundFQDN string
|
||||||
|
DindVolumeSize string
|
||||||
}
|
}
|
||||||
|
|
||||||
type SessionSetupInstanceConf struct {
|
type SessionSetupInstanceConf struct {
|
||||||
@@ -250,6 +251,7 @@ func (p *pwd) SessionSetup(session *types.Session, sconf SessionSetupConf) error
|
|||||||
PlaygroundFQDN: sconf.PlaygroundFQDN,
|
PlaygroundFQDN: sconf.PlaygroundFQDN,
|
||||||
Type: conf.Type,
|
Type: conf.Type,
|
||||||
Tls: conf.Tls,
|
Tls: conf.Tls,
|
||||||
|
DindVolumeSize: sconf.DindVolumeSize,
|
||||||
}
|
}
|
||||||
i, err := p.InstanceNew(session, instanceConf)
|
i, err := p.InstanceNew(session, instanceConf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user