feat: establish Orbit models, migrations and development baseline
This commit is contained in:
33
sdk/go/examples/health/main.go
Normal file
33
sdk/go/examples/health/main.go
Normal file
@@ -0,0 +1,33 @@
|
||||
// Run against a started bootstrap server: ORBIT_URL=http://127.0.0.1:8080 go run ./examples/health
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
orbit "git.yuntuo.hk/k2safe/orbit/sdk/go"
|
||||
"log"
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
|
||||
func main() {
|
||||
address := os.Getenv("ORBIT_URL")
|
||||
if address == "" {
|
||||
address = "http://127.0.0.1:8080"
|
||||
}
|
||||
client, err := orbit.NewClient(address, orbit.Options{})
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
defer cancel()
|
||||
live, err := client.Liveness(ctx)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
ready, err := client.Readiness(ctx)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
fmt.Printf("liveness=%s readiness=%s scope=%s\n", live.Status, ready.Status, ready.Scope)
|
||||
}
|
||||
Reference in New Issue
Block a user