A GRPC Server Runner for use with grace.
package main
import (
"context"
"github.com/tomwright/grace"
"github.com/tomwright/gracehttpserverrunner"
"net/http"
"time"
)
func main() {
g := grace.Init(context.Background())
// Create and configure your HTTP server.
server := &http.Server{
Addr: ":8080",
Handler: http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {}),
}
// Create and configure the HTTP server runner.
runner := &gracehttpserverrunner.HTTPServerRunner{
Server: server,
ShutdownTimeout: time.Second * 5,
}
// Run the runner.
g.Run(runner)
g.Wait()
}