https://github.com/go-flexible/flexready
A flex compatible readiness server.
https://github.com/go-flexible/flexready
12-factor go golang golang-library microservice readiness
Last synced: 2 months ago
JSON representation
A flex compatible readiness server.
- Host: GitHub
- URL: https://github.com/go-flexible/flexready
- Owner: go-flexible
- License: apache-2.0
- Created: 2021-06-21T17:25:54.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2022-04-16T21:37:49.000Z (almost 4 years ago)
- Last Synced: 2024-06-20T00:26:54.868Z (almost 2 years ago)
- Topics: 12-factor, go, golang, golang-library, microservice, readiness
- Language: Go
- Homepage:
- Size: 33.2 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# flexready
[](https://github.com/go-flexible/flexready/actions/workflows/go.yml)
A [flex](https://github.com/go-flexible/flex) compatible readiness server.
## Install
```shell
go get github.com/go-flexible/flexready
```
## Configuration
The readiness server can be configured through the environment to match setup in
the infrastructure.
- `FLEX_READYSRV_ADDR` default: `0.0.0.0:3674`
- `FLEX_READYSRV_LIVENESS_PATH` default: `/live`
- `FLEX_READYSRV_READINESS_PATH` default: `/ready`
## Example
```go
// Prepare your readyserver.
readysrv := flexready.New(flexready.Checks{
"redis": func() error { return redisCheck(nil) },
"cockroachdb": func() error { return cockroachCheck(nil) },
}, flexready.WithAddress(":9999"))
// Run it, or better yet, let `flex` run it for you!
_ = readysrv.Run(context.Background())
// Liveness endpoint: http://localhost:9999/live
// Readiness endpoint: http://localhost:9999/ready
```