Multiple playgrounds support (#215)
* Add Playground struct and basic support for creating it and retrieving it * Add missing functions in pwd mock * Get playground from request domain and validate it exists. If valid set it on the newly created session. * Move playground specific configurations to the playground struct and use it everytime we need that conf. * Don't allow to specify a duration bigger that the allowed in the playground
This commit is contained in:
committed by
GitHub
parent
3dee0d3f0b
commit
3f5b3882dd
@@ -2,15 +2,16 @@ package handlers
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"log"
|
||||
"net/http"
|
||||
|
||||
"github.com/play-with-docker/play-with-docker/config"
|
||||
)
|
||||
|
||||
func GetInstanceImages(rw http.ResponseWriter, req *http.Request) {
|
||||
instanceImages := []string{
|
||||
config.GetDindImageName(),
|
||||
"franela/dind:dev",
|
||||
playground := core.PlaygroundFindByDomain(req.Host)
|
||||
if playground == nil {
|
||||
log.Printf("Playground for domain %s was not found!", req.Host)
|
||||
rw.WriteHeader(http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
json.NewEncoder(rw).Encode(instanceImages)
|
||||
json.NewEncoder(rw).Encode(playground.AvailableDinDInstanceImages)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user