diff --git a/api/RootCert.go b/api/RootCert.go index ce031c3..16ac286 100644 --- a/api/RootCert.go +++ b/api/RootCert.go @@ -6,6 +6,7 @@ import ( "net/http" "os" "scm/model" + "scm/utils" ) func RootCert(w http.ResponseWriter, r *http.Request) { @@ -16,7 +17,6 @@ func RootCert(w http.ResponseWriter, r *http.Request) { http.Error(w, err.Error(), http.StatusInternalServerError) return } - fmt.Fprintf(w, `{"status":"ok"}`) case "POST": var rootCertRequest model.CreateRootCertRequest @@ -25,9 +25,11 @@ func RootCert(w http.ResponseWriter, r *http.Request) { http.Error(w, err.Error(), http.StatusBadRequest) return } - - - + err = utils.CreateRootKeyCertificate(rootCertRequest) + if err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } fmt.Fprintf(w, `{"status":"ok"}`) default: http.Error(w, "Method not allowed", http.StatusMethodNotAllowed) diff --git a/api/frontend/index.html b/api/frontend/index.html index 800d4ba..15f0af2 100644 --- a/api/frontend/index.html +++ b/api/frontend/index.html @@ -8,6 +8,7 @@ + Scm