Integrate mkube storageclass api with UI (#156)

This commit is contained in:
César Nieto
2020-06-04 11:22:33 -07:00
committed by GitHub
parent d8e6bd7f4a
commit 8949fbe245
7 changed files with 129 additions and 147 deletions

View File

@@ -164,7 +164,7 @@ func FileServerMiddleware(next http.Handler) http.Handler {
switch {
case strings.HasPrefix(r.URL.Path, "/ws"):
serveWS(w, r)
case strings.HasPrefix(r.URL.Path, "/api/v1/tenants"):
case strings.HasPrefix(r.URL.Path, "/api/v1/mkube"):
client := &http.Client{}
serverMkube(client, w, r)
case strings.HasPrefix(r.URL.Path, "/api"):

View File

@@ -30,6 +30,7 @@ import (
// serverMkube handles calls for mkube
func serverMkube(client *http.Client, w http.ResponseWriter, req *http.Request) {
// destination of the request, the mkube server
req.URL.Path = strings.Replace(req.URL.Path, "/mkube", "", 1)
targetURL := fmt.Sprintf("%s%s", getM3Host(), req.URL.String())
// set the HTTP method, url, and m3Req body