mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
chore: update default service config
This commit is contained in:
@ -63,11 +63,23 @@ func NewAPIV1Service(secret string, profile *profile.Profile, store *store.Store
|
|||||||
|
|
||||||
// RegisterGateway registers the gRPC-Gateway with the given Echo instance.
|
// RegisterGateway registers the gRPC-Gateway with the given Echo instance.
|
||||||
func (s *APIV1Service) RegisterGateway(ctx context.Context, echoServer *echo.Echo) error {
|
func (s *APIV1Service) RegisterGateway(ctx context.Context, echoServer *echo.Echo) error {
|
||||||
// Create a client connection to the gRPC Server we just started.
|
// Override the default service config:
|
||||||
// This is where the gRPC-Gateway proxies the requests.
|
// * Set the maximum request/response message size to 100MB.
|
||||||
|
serviceConfig := `
|
||||||
|
{
|
||||||
|
"methodConfig": [
|
||||||
|
{
|
||||||
|
"name": [{}],
|
||||||
|
"maxRequestMessageBytes": 104857600,
|
||||||
|
"maxResponseMessageBytes": 104857600
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
`
|
||||||
conn, err := grpc.DialContext(
|
conn, err := grpc.DialContext(
|
||||||
ctx,
|
ctx,
|
||||||
fmt.Sprintf(":%d", s.Profile.Port),
|
fmt.Sprintf(":%d", s.Profile.Port),
|
||||||
|
grpc.WithDefaultServiceConfig(serviceConfig),
|
||||||
grpc.WithTransportCredentials(insecure.NewCredentials()),
|
grpc.WithTransportCredentials(insecure.NewCredentials()),
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Reference in New Issue
Block a user