erigon-pulse/diagnostics/cmd_line.go
ledgerwatch 3d904d509e
[Diagnostics] expose command line args via metrics (#7271)
Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
2023-04-06 15:34:06 +00:00

23 lines
388 B
Go

package diagnostics
import (
"fmt"
"io"
"net/http"
"os"
)
func SetupCmdLineAccess() {
http.HandleFunc("/debug/metrics/cmdline", func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Access-Control-Allow-Origin", "*")
writeCmdLine(w)
})
}
func writeCmdLine(w io.Writer) {
fmt.Fprintf(w, "SUCCESS\n")
for _, arg := range os.Args {
fmt.Fprintf(w, "%s\n", arg)
}
}