@@ -138,6 +138,10 @@ func NewRootCmd(l zerolog.Logger) *cobra.Command {
138138 grpcconn .WithCLIVersion (fullVersion ()),
139139 }
140140
141+ if maxRecv := apiMaxRecvMsgSize (); maxRecv > 0 {
142+ opts = append (opts , grpcconn .WithMaxRecvMsgSize (maxRecv ))
143+ }
144+
141145 if caValue := viper .GetString (confOptions .controlplaneCA .viperKey ); caValue != "" {
142146 // Check if the value is a file path, if it is we read the content and encode it to base64, if not we assume it's the content already
143147 if _ , err := os .Stat (caValue ); err == nil {
@@ -265,6 +269,11 @@ func NewRootCmd(l zerolog.Logger) *cobra.Command {
265269 cobra .CheckErr (viper .BindPFlag (confOptions .insecure .viperKey , rootCmd .PersistentFlags ().Lookup ("insecure" )))
266270 cobra .CheckErr (viper .BindEnv (confOptions .insecure .viperKey , CalculateEnvVarName (confOptions .insecure .viperKey )))
267271
272+ // Override the gRPC client-side max receive message size in bytes (0 = use default)
273+ rootCmd .PersistentFlags ().Int (confOptions .maxRecvMsgSize .flagName , 0 , fmt .Sprintf ("Max size in bytes for incoming gRPC messages (0 = default %d) ($%s)" , grpcconn .DefaultMaxRecvMsgSize , CalculateEnvVarName (confOptions .maxRecvMsgSize .viperKey )))
274+ cobra .CheckErr (viper .BindPFlag (confOptions .maxRecvMsgSize .viperKey , rootCmd .PersistentFlags ().Lookup (confOptions .maxRecvMsgSize .flagName )))
275+ cobra .CheckErr (viper .BindEnv (confOptions .maxRecvMsgSize .viperKey , CalculateEnvVarName (confOptions .maxRecvMsgSize .viperKey )))
276+
268277 rootCmd .PersistentFlags ().BoolVar (& flagDebug , "debug" , false , "Enable debug/verbose logging mode" )
269278 rootCmd .PersistentFlags ().StringVarP (& flagOutputFormat , "output" , "o" , "table" , "Output format, valid options are json and table" )
270279
@@ -499,6 +508,12 @@ func apiInsecure() bool {
499508 return viper .GetBool (confOptions .insecure .viperKey )
500509}
501510
511+ // apiMaxRecvMsgSize returns the configured gRPC max receive message size for
512+ // the CLI's outbound connections, in bytes. 0 means "use grpcconn's default".
513+ func apiMaxRecvMsgSize () int {
514+ return viper .GetInt (confOptions .maxRecvMsgSize .viperKey )
515+ }
516+
502517// setLocalOrganization updates the local organization configuration
503518func setLocalOrganization (orgName string ) error {
504519 viper .Set (confOptions .organization .viperKey , orgName )
0 commit comments