From 2c270438ecb149f3fd9fcf9dd12161eff322e3e2 Mon Sep 17 00:00:00 2001 From: Steven Date: Wed, 8 May 2024 06:57:53 +0800 Subject: [PATCH] chore: update default service config --- server/router/api/v1/v1.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/server/router/api/v1/v1.go b/server/router/api/v1/v1.go index 4c9fa7f6e..ac6f93d7f 100644 --- a/server/router/api/v1/v1.go +++ b/server/router/api/v1/v1.go @@ -63,11 +63,23 @@ func NewAPIV1Service(secret string, profile *profile.Profile, store *store.Store // RegisterGateway registers the gRPC-Gateway with the given Echo instance. func (s *APIV1Service) RegisterGateway(ctx context.Context, echoServer *echo.Echo) error { - // Create a client connection to the gRPC Server we just started. - // This is where the gRPC-Gateway proxies the requests. + // Override the default service config: + // * Set the maximum request/response message size to 100MB. + serviceConfig := ` +{ + "methodConfig": [ + { + "name": [{}], + "maxRequestMessageBytes": 104857600, + "maxResponseMessageBytes": 104857600 + } + ] +} +` conn, err := grpc.DialContext( ctx, fmt.Sprintf(":%d", s.Profile.Port), + grpc.WithDefaultServiceConfig(serviceConfig), grpc.WithTransportCredentials(insecure.NewCredentials()), ) if err != nil {