This commit is contained in:
eson 2023-11-21 18:30:26 +08:00
parent ebcd27bbd5
commit 81df0950e3
5 changed files with 18 additions and 4 deletions

2
go.mod
View File

@ -48,4 +48,4 @@ require (
gopkg.in/yaml.v3 v3.0.1 // indirect
)
replace fusen-basic v0.0.0 => gitee.com/fusenpack/fusen-basic v0.0.5-0.20231117090447-740c4f28fda6
replace fusen-basic v0.0.0 => gitee.com/fusenpack/fusen-basic v0.0.5-0.20231121101006-c27585d89386

4
go.sum
View File

@ -1,6 +1,6 @@
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
gitee.com/fusenpack/fusen-basic v0.0.5-0.20231117090447-740c4f28fda6 h1:u/iTiW6mFHp5/sqEPrO/JalEAur6UK5PKE7YXHJ+/0o=
gitee.com/fusenpack/fusen-basic v0.0.5-0.20231117090447-740c4f28fda6/go.mod h1:M6MEfmoOqiH6z2xfGb3WMd+jADI42flrUrNv2WoFE8A=
gitee.com/fusenpack/fusen-basic v0.0.5-0.20231121101006-c27585d89386 h1:SlQpIMqtLEiOQWmwGXxD00k8rMI2ACqgOCyTcw9fR/Q=
gitee.com/fusenpack/fusen-basic v0.0.5-0.20231121101006-c27585d89386/go.mod h1:M6MEfmoOqiH6z2xfGb3WMd+jADI42flrUrNv2WoFE8A=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/HdrHistogram/hdrhistogram-go v1.1.2/go.mod h1:yDgFjdqOqDEKOvasDdhWNXYg9BVp4O+o5f6V/ehm6Oo=
github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw=

2
proto

@ -1 +1 @@
Subproject commit 52c178825e99f266f148f361db587d06f88806fb
Subproject commit 421740c5cf009368523e2966e4c8ade4a316a6c8

View File

@ -16,6 +16,11 @@ func AutoRegisterHandler(ctx context.Context, mux *runtime.ServeMux, opts ...grp
return err
}
err = service.RegisterNotifyHandlerClientNacos(ctx, mux, opts...)
if err != nil {
return err
}
err = service.RegisterInfoHandlerClientNacos(ctx, mux, opts...)
if err != nil {
return err

View File

@ -2,6 +2,7 @@ package main
import (
"context"
"log"
"fusen-basic/env"
"fusen-gateway/gen/go/service"
@ -27,12 +28,20 @@ func main() {
ctx, cancel := context.WithCancel(ctx)
defer cancel()
mux := runtime.NewServeMux(
runtime.WithErrorHandler(func(ctx context.Context, sm *runtime.ServeMux, m runtime.Marshaler, w http.ResponseWriter, r *http.Request, err error) {
log.Println(err)
w.Write([]byte("\n" + err.Error()))
}),
runtime.WithMetadata(logic.PassMetadata),
runtime.WithForwardResponseOption(logic.ResponseHeaderMatcher),
runtime.WithMarshalerOption("*", &logic.EmptyMarshaler{}),
)
opts := []grpc.DialOption{
grpc.WithUnaryInterceptor(func(ctx context.Context, method string, req, reply any, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error {
log.Println(method)
return invoker(ctx, method, req, reply, cc, opts...)
}),
grpc.WithTransportCredentials(insecure.NewCredentials()),
}