mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-25 21:17:16 +00:00
a41ad2d94b
…ommand --------- Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
26 lines
501 B
Go
26 lines
501 B
Go
package diagnostics
|
|
|
|
import (
|
|
"fmt"
|
|
"io"
|
|
"net/http"
|
|
|
|
"github.com/ledgerwatch/erigon/params"
|
|
)
|
|
|
|
const Version = 1
|
|
|
|
func SetupVersionAccess() {
|
|
http.HandleFunc("/debug/metrics/version", func(w http.ResponseWriter, r *http.Request) {
|
|
w.Header().Set("Access-Control-Allow-Origin", "*")
|
|
writeVersion(w)
|
|
})
|
|
}
|
|
|
|
func writeVersion(w io.Writer) {
|
|
fmt.Fprintf(w, "SUCCESS\n")
|
|
fmt.Fprintf(w, "%d\n", Version)
|
|
fmt.Fprintf(w, "%s\n", params.VersionWithMeta)
|
|
fmt.Fprintf(w, "%s\n", params.GitCommit)
|
|
}
|