mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-22 19:50:36 +00:00
f794438335
Code to support react based UI for diagnostics: * pprof, prometheus and diagnistics rationalized to use a single router (i.e. they can all run in the same port) * support_cmd updated to support node routing (was only first node) * Multi content support in router tunnel (application/octet-stream & appliaction/json) * Routing requests changed from using http forms to rest + query params * REST query requests can now be made against erigon base port and diagnostics with the same url format/params --------- Co-authored-by: dvovk <vovk.dimon@gmail.com> Co-authored-by: Mark Holt <mark@disributed.vision>
27 lines
600 B
Go
27 lines
600 B
Go
package diagnostics
|
|
|
|
import (
|
|
"encoding/json"
|
|
"net/http"
|
|
|
|
"github.com/ledgerwatch/erigon/params"
|
|
)
|
|
|
|
const Version = 3
|
|
|
|
func SetupVersionAccess(metricsMux *http.ServeMux) {
|
|
metricsMux.HandleFunc("/version", func(w http.ResponseWriter, r *http.Request) {
|
|
w.Header().Set("Access-Control-Allow-Origin", "*")
|
|
w.Header().Set("Content-Type", "application/json")
|
|
json.NewEncoder(w).Encode(struct {
|
|
Node int `json:"nodeVersion"`
|
|
Code string `json:"codeVersion"`
|
|
Git string `json:"gitCommit"`
|
|
}{
|
|
Node: Version,
|
|
Code: params.VersionWithMeta,
|
|
Git: params.GitCommit,
|
|
})
|
|
})
|
|
}
|