implement grpc gateway for http api
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-24 16:47:54 -04:00
parent 2c78dcc133
commit 9077ae354a
15 changed files with 668 additions and 187 deletions

9
app.go
View File

@ -9,8 +9,8 @@ import (
weatherpb "gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/api/v1alpha1/weather"
"gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/ambient"
"gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/ambient/ambientgrpc"
"gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/ambient/ambienthttp"
weathergrpc "gitea.libretechconsulting.com/rmcguire/ambient-local-exporter/pkg/weather/grpc"
)
func prepareApp(ctx context.Context, aw *ambient.AmbientWeather) *app.App {
@ -51,7 +51,12 @@ func prepareApp(ctx context.Context, aw *ambient.AmbientWeather) *app.App {
{
Name: "Weather Service",
Type: &weatherpb.AmbientLocalWeatherService_ServiceDesc,
Service: weathergrpc.NewGRPCWeather(ctx, aw.GetRecorder()),
Service: ambientgrpc.NewGRPCWeather(ctx, aw.GetRecorder()),
GwRegistrationFuncs: []grpcopts.GwRegistrationFunc{
// HTTP API via grpc-gateway. Update path in app grpc config
// to change default (/grpcapi)
weatherpb.RegisterAmbientLocalWeatherServiceHandler,
},
},
},
},