mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-03 09:37:38 +00:00
24 lines
484 B
Go
24 lines
484 B
Go
|
package diagnostics
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"io"
|
||
|
"net/http"
|
||
|
|
||
|
"github.com/urfave/cli/v2"
|
||
|
)
|
||
|
|
||
|
func SetupFlagsAccess(ctx *cli.Context) {
|
||
|
http.HandleFunc("/debug/metrics/flags", func(w http.ResponseWriter, r *http.Request) {
|
||
|
w.Header().Set("Access-Control-Allow-Origin", "*")
|
||
|
writeFlags(w, ctx)
|
||
|
})
|
||
|
}
|
||
|
|
||
|
func writeFlags(w io.Writer, ctx *cli.Context) {
|
||
|
fmt.Fprintf(w, "SUCCESS\n")
|
||
|
for _, flagName := range ctx.FlagNames() {
|
||
|
fmt.Fprintf(w, "%s=%v\n", flagName, ctx.Value(flagName))
|
||
|
}
|
||
|
}
|