docs: add readme

This commit is contained in:
Mohamed Sohail 2021-12-14 18:03:47 +03:00
parent e597be41d5
commit 6ce4b88a5a
Signed by: kamikazechaser
GPG Key ID: 7DD45520C01CD85D
3 changed files with 17 additions and 2 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
vendor/

15
README.md Normal file
View 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`

View File

@ -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,
}) })