mirror of
				https://github.com/ClusterCockpit/cc-backend
				synced 2025-11-01 00:15:05 +01:00 
			
		
		
		
	Fix memoryStore Init and move MetricConfig init
This commit is contained in:
		| @@ -2,6 +2,7 @@ | ||||
| // All rights reserved. This file is part of cc-backend. | ||||
| // Use of this source code is governed by a MIT-style | ||||
| // license that can be found in the LICENSE file. | ||||
|  | ||||
| package api | ||||
|  | ||||
| import ( | ||||
| @@ -15,8 +16,8 @@ import ( | ||||
| 	"github.com/ClusterCockpit/cc-lib/schema" | ||||
| ) | ||||
|  | ||||
| // GetClustersApiResponse model | ||||
| type GetClustersApiResponse struct { | ||||
| // GetClustersAPIResponse model | ||||
| type GetClustersAPIResponse struct { | ||||
| 	Clusters []*schema.Cluster `json:"clusters"` // Array of clusters | ||||
| } | ||||
|  | ||||
| @@ -59,7 +60,7 @@ func (api *RestApi) getClusters(rw http.ResponseWriter, r *http.Request) { | ||||
| 		clusters = archive.Clusters | ||||
| 	} | ||||
|  | ||||
| 	payload := GetClustersApiResponse{ | ||||
| 	payload := GetClustersAPIResponse{ | ||||
| 		Clusters: clusters, | ||||
| 	} | ||||
|  | ||||
|   | ||||
| @@ -97,11 +97,15 @@ func (api *RestApi) MountUserApiRoutes(r *mux.Router) { | ||||
|  | ||||
| func (api *RestApi) MountMetricStoreApiRoutes(r *mux.Router) { | ||||
| 	// REST API Uses TokenAuth | ||||
| 	// Refactor ?? | ||||
| 	r.HandleFunc("/api/free", freeMetrics).Methods(http.MethodPost) | ||||
| 	r.HandleFunc("/api/write", writeMetrics).Methods(http.MethodPost) | ||||
| 	r.HandleFunc("/api/debug", debugMetrics).Methods(http.MethodGet) | ||||
| 	r.HandleFunc("/api/healthcheck", metricsHealth).Methods(http.MethodGet) | ||||
| 	// Same endpoints but with trailing slash | ||||
| 	r.HandleFunc("/api/free/", freeMetrics).Methods(http.MethodPost) | ||||
| 	r.HandleFunc("/api/write/", writeMetrics).Methods(http.MethodPost) | ||||
| 	r.HandleFunc("/api/debug/", debugMetrics).Methods(http.MethodGet) | ||||
| 	r.HandleFunc("/api/healthcheck/", metricsHealth).Methods(http.MethodGet) | ||||
| } | ||||
|  | ||||
| func (api *RestApi) MountConfigApiRoutes(r *mux.Router) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user