Skip to content

Commit

Permalink
chore(grpc): Set grpc.max_receive_message_length to -1
Browse files Browse the repository at this point in the history
  • Loading branch information
m8rmclaren committed Oct 21, 2024
1 parent 8a1ead6 commit 1cbfabe
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/GoogleCAProxy/GoogleCAProxy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using CAProxy.Common;
using CSS.PKI;
using Google.Api.Gax;
using Google.Api.Gax.Grpc;
using Google.Cloud.Security.PrivateCA.V1;
using Google.Protobuf.WellKnownTypes;
using Grpc.Core;
Expand Down Expand Up @@ -644,12 +645,19 @@ private CAConnectorCertificate ProcessCAResponse(Certificate caCertificate)
/// <returns></returns>
private static CertificateAuthorityServiceClient BuildClient()
{
CertificateAuthorityServiceClientBuilder caClient = new CertificateAuthorityServiceClientBuilder
string credentialsPath = Environment.GetEnvironmentVariable(AuthEnvVariableName, EnvironmentVariableTarget.Machine);

// Set the gRPC buffer size to -1 for "no limit"
// https://grpc.github.io/grpc/core/group__grpc__arg__keys.html#ga813f94f9ac3174571dd712c96cdbbdc1
GrpcChannelOptions grpcChannelOptions = GrpcChannelOptions.Empty.WithMaxReceiveMessageSize(-1);

CertificateAuthorityServiceClientBuilder caClientBuilder = new CertificateAuthorityServiceClientBuilder
{
CredentialsPath =
Environment.GetEnvironmentVariable(AuthEnvVariableName, EnvironmentVariableTarget.Machine)
CredentialsPath = credentialsPath,
GrpcChannelOptions = grpcChannelOptions,
};
return caClient.Build();

return caClientBuilder.Build();
}

#endregion
Expand Down

0 comments on commit 1cbfabe

Please sign in to comment.