Compare commits

..

No commits in common. "82c08a7bc3e30e2f4eda9e947618d7bfc5873844" and "f201ac1fca62fb601477822f7b46515d56e61f1c" have entirely different histories.

3 changed files with 20 additions and 6 deletions

2
go.mod
View File

@ -3,7 +3,7 @@ module gitea.libretechconsulting.com/rmcguire/ambient-local-exporter
go 1.24.1
require (
gitea.libretechconsulting.com/rmcguire/go-app v0.9.1
gitea.libretechconsulting.com/rmcguire/go-app v0.9.0
github.com/go-resty/resty/v2 v2.16.5
github.com/gorilla/schema v1.4.1
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3

2
go.sum
View File

@ -8,8 +8,6 @@ gitea.libretechconsulting.com/rmcguire/go-app v0.8.1 h1:pnmFJnY77dsh84zvVcHqFuQg
gitea.libretechconsulting.com/rmcguire/go-app v0.8.1/go.mod h1:W6YHFSGf4nJrgs9DqEaw+3J6ufIARsr1zpOs/V6gRTQ=
gitea.libretechconsulting.com/rmcguire/go-app v0.9.0 h1:ZOBdVk2EehGCX6K3pdT5Dy07bMiUR7VTifE+n0ODfak=
gitea.libretechconsulting.com/rmcguire/go-app v0.9.0/go.mod h1:W6YHFSGf4nJrgs9DqEaw+3J6ufIARsr1zpOs/V6gRTQ=
gitea.libretechconsulting.com/rmcguire/go-app v0.9.1 h1:QihWX1YeCqttpAjXq6nHWvNk1MpIhuW8bSO3G+fbsRg=
gitea.libretechconsulting.com/rmcguire/go-app v0.9.1/go.mod h1:W6YHFSGf4nJrgs9DqEaw+3J6ufIARsr1zpOs/V6gRTQ=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=

View File

@ -9,9 +9,25 @@ import (
func (aw *AmbientWeather) GetGatewayOpts() []runtime.ServeMuxOption {
return []runtime.ServeMuxOption{
runtime.WithErrorHandler(func(ctx context.Context, sm *runtime.ServeMux, m runtime.Marshaler, w http.ResponseWriter, req *http.Request, err error) {
aw.GetLogger().Err(err).Msg("error handling gateway request")
runtime.DefaultHTTPErrorHandler(ctx, sm, m, w, req, err)
runtime.WithMiddlewares(func(hf runtime.HandlerFunc) runtime.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request, pathParams map[string]string) {
aw.GetLogger().Trace().
Any("pathParams", pathParams).
Msg("inbound request called")
}
}),
runtime.WithRoutingErrorHandler(
func(
ctx context.Context, mux *runtime.ServeMux, mshl runtime.Marshaler,
w http.ResponseWriter, r *http.Request, code int,
) {
aw.GetLogger().Trace().
Int("code", code).
Str("pattern", r.Pattern).
Msg("requesting grpc-gateway route")
// Pass back to default
runtime.DefaultRoutingErrorHandler(ctx, mux, mshl, w, r, code)
}),
}
}