Skip to content

Commit 7432d3e

Browse files
make max-recv-message-size a cli option
Signed-off-by: Steven Borrelli <[email protected]>
1 parent fb11226 commit 7432d3e

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

main.go

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,15 @@ import (
77
"github.com/crossplane/function-sdk-go"
88
)
99

10-
// MaxRecvMessageSize sets the maximum message size. gRPC default is 4MB
11-
const MaxRecvMessageSize = 1024 * 1024 * 16
12-
1310
// CLI of this Function.
1411
type CLI struct {
1512
Debug bool `short:"d" help:"Emit debug logs in addition to info logs."`
1613

17-
Network string `help:"Network on which to listen for gRPC connections." default:"tcp"`
18-
Address string `help:"Address at which to listen for gRPC connections." default:":9443"`
19-
TLSCertsDir string `help:"Directory containing server certs (tls.key, tls.crt) and the CA used to verify client certificates (ca.crt)" env:"TLS_SERVER_CERTS_DIR"`
20-
Insecure bool `help:"Run without mTLS credentials. If you supply this flag --tls-server-certs-dir will be ignored."`
14+
Network string `help:"Network on which to listen for gRPC connections." default:"tcp"`
15+
Address string `help:"Address at which to listen for gRPC connections." default:":9443"`
16+
TLSCertsDir string `help:"Directory containing server certs (tls.key, tls.crt) and the CA used to verify client certificates (ca.crt)" env:"TLS_SERVER_CERTS_DIR"`
17+
Insecure bool `help:"Run without mTLS credentials. If you supply this flag --tls-server-certs-dir will be ignored."`
18+
MaxRecvMessageSize int `help:"gRPC maximum message size in bytes. Increase this when processing large Composites." default:"4194304"`
2119
}
2220

2321
// Run this Function.
@@ -35,8 +33,7 @@ func (c *CLI) Run() error {
3533
function.Listen(c.Network, c.Address),
3634
function.MTLSCertificates(c.TLSCertsDir),
3735
function.Insecure(c.Insecure),
38-
function.MaxRecvMessageSize(MaxRecvMessageSize),
39-
)
36+
function.MaxRecvMessageSize(c.MaxRecvMessageSize))
4037
}
4138

4239
func main() {

0 commit comments

Comments
 (0)