docs: add readme
This commit is contained in:
parent
e597be41d5
commit
6ce4b88a5a
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
vendor/
|
15
README.md
Normal file
15
README.md
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
### openethereum-node-status
|
||||||
|
|
||||||
|
A tiny stateless service to return health status and useful metrics from OpenEthereum/Parity nodes. Requires the [following API's](https://openethereum.github.io/JSONRPC) to be enabled:
|
||||||
|
|
||||||
|
- eth
|
||||||
|
- parity
|
||||||
|
|
||||||
|
#### Endpoints
|
||||||
|
|
||||||
|
- `/health` (Expect 200 for health with an additional JSON object with more info)
|
||||||
|
- `/metrics` (Expect 200 for health with an additional JSON object with more info)
|
||||||
|
|
||||||
|
#### Development
|
||||||
|
|
||||||
|
`DEBUG_ENABLED=true go run cmd/node-status/main.go`
|
@ -24,15 +24,14 @@ func healthHandler(c *gin.Context) {
|
|||||||
|
|
||||||
fmt.Println(data.SyncComplete)
|
fmt.Println(data.SyncComplete)
|
||||||
if !allOk {
|
if !allOk {
|
||||||
|
// choose a better status code if available
|
||||||
c.JSON(http.StatusExpectationFailed, gin.H{
|
c.JSON(http.StatusExpectationFailed, gin.H{
|
||||||
"ok": false,
|
|
||||||
"message": "could not get node health status",
|
"message": "could not get node health status",
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.JSON(http.StatusOK, gin.H{
|
c.JSON(http.StatusOK, gin.H{
|
||||||
"ok": true,
|
|
||||||
"syncComplete": data.SyncComplete,
|
"syncComplete": data.SyncComplete,
|
||||||
"chainName": data.ChainName,
|
"chainName": data.ChainName,
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user