Cosmos-Server/src/configapi/get.go
2023-03-10 20:59:56 +00:00

32 lines
624 B
Go

package user
import (
"net/http"
"encoding/json"
"github.com/gorilla/mux"
"../utils"
)
func ConfigApiGet(w http.ResponseWriter, req *http.Request) {
if AdminOnly(w, req) != nil {
return
}
if(req.Method == "GET") {
config := utils.GetBaseMainConfig()
// delete AuthPrivateKey and TLSKey
config.AuthPrivateKey = ""
config.TLSKey = ""
json.NewEncoder(w).Encode(map[string]interface{}{
"status": "OK",
"data": config,
})
} else {
utils.Error("SettingGet: Method not allowed" + req.Method, nil)
utils.HTTPError(w, "Method not allowed", http.StatusMethodNotAllowed, "HTTP001")
return
}
}