Add support for setting alias when creatign instance. (#140)

* Add support for setting alias when creatign instance.

The POST to create a instance now provides an `alias` field which
then can be used to access the instance services through the following
URL:

`http://<alias>-<short_session>-<port>.<tld>`

When creating a session you can now send an `alias`

* Remove unnecessary function

* Add alias support for DNS resolution
This commit is contained in:
Marcos Nils
2017-05-11 17:39:17 -03:00
committed by GitHub
parent 62c5d3761d
commit 61a0bb4db1
5 changed files with 59 additions and 6 deletions

View File

@@ -13,7 +13,7 @@ func NewInstance(rw http.ResponseWriter, req *http.Request) {
vars := mux.Vars(req)
sessionId := vars["sessionId"]
body := struct{ ImageName string }{}
body := struct{ ImageName, Alias string }{}
json.NewDecoder(req.Body).Decode(&body)
@@ -26,7 +26,7 @@ func NewInstance(rw http.ResponseWriter, req *http.Request) {
return
}
i, err := services.NewInstance(s, body.ImageName)
i, err := services.NewInstance(s, body.ImageName, body.Alias)
if err != nil {
log.Println(err)
rw.WriteHeader(http.StatusInternalServerError)