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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user