implement grpc gateway for http api
This commit is contained in:
9
app.go
9
app.go
@ -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,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
Reference in New Issue
Block a user