mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-22 11:41:19 +00:00
19 lines
482 B
Go
19 lines
482 B
Go
|
package diagnostics
|
||
|
|
||
|
import (
|
||
|
"encoding/json"
|
||
|
"net/http"
|
||
|
)
|
||
|
|
||
|
func SetupStagesAccess(metricsMux *http.ServeMux, diag *DiagnosticClient) {
|
||
|
metricsMux.HandleFunc("/snapshot-sync", func(w http.ResponseWriter, r *http.Request) {
|
||
|
w.Header().Set("Access-Control-Allow-Origin", "*")
|
||
|
w.Header().Set("Content-Type", "application/json")
|
||
|
writeStages(w, diag)
|
||
|
})
|
||
|
}
|
||
|
|
||
|
func writeStages(w http.ResponseWriter, diag *DiagnosticClient) {
|
||
|
json.NewEncoder(w).Encode(diag.SnapshotDownload())
|
||
|
}
|