support runtime.ServeMux opts for grpc-gateway
All checks were successful
Build and Publish / release (push) Has been skipped
Build and Publish / check-chart (push) Successful in 10s
Build and Publish / helm-release (push) Has been skipped

This commit is contained in:
2025-03-25 17:05:59 -04:00
parent 1e481627e3
commit f201ac1fca
10 changed files with 78 additions and 6 deletions

10
app.go
View File

@ -2,6 +2,7 @@ package main
import (
"context"
"errors"
"gitea.libretechconsulting.com/rmcguire/go-app/pkg/app"
grpcopts "gitea.libretechconsulting.com/rmcguire/go-app/pkg/srv/grpc/opts"
@ -38,11 +39,13 @@ func prepareApp(ctx context.Context, aw *ambient.AmbientWeather) *app.App {
CustomListener: ambienthttp.NewAWNMutatingListener(ctx,
aw.Config.HTTP.Listen), // Necessary to fix certain bad AWN firmware
// Health check funcs
HealthChecks: []httpopts.HealthCheckFunc{
// TODO: Implement
// Check recorder health
// Only redis implements this
func(ctx context.Context) error {
return nil
var errs error
errs = errors.Join(errs, aw.GetRecorder().Ping(ctx))
return errs
},
},
},
@ -52,6 +55,7 @@ func prepareApp(ctx context.Context, aw *ambient.AmbientWeather) *app.App {
GRPCDialOpts: []grpc.DialOption{
grpc.WithTransportCredentials(insecure.NewCredentials()),
},
GRPCGatewayOpts: aw.GetGatewayOpts(),
Services: []*grpcopts.GRPCService{
{
Name: "Weather Service",