@@ -5,6 +5,7 @@ package main
5
5
import (
6
6
"context"
7
7
log "github.com/sirupsen/logrus"
8
+ "go.amzn.com/lambda/interop"
8
9
"go.amzn.com/lambda/rapidcore"
9
10
"os"
10
11
"runtime/debug"
@@ -28,6 +29,7 @@ type LsOpts struct {
28
29
EdgePort string
29
30
EnableXRayTelemetry string
30
31
PostInvokeWaitMS string
32
+ MaxPayloadSize string
31
33
}
32
34
33
35
func GetEnvOrDie (env string ) string {
@@ -50,6 +52,7 @@ func InitLsOpts() *LsOpts {
50
52
User : GetenvWithDefault ("LOCALSTACK_USER" , "sbx_user1051" ),
51
53
InitLogLevel : GetenvWithDefault ("LOCALSTACK_INIT_LOG_LEVEL" , "warn" ),
52
54
EdgePort : GetenvWithDefault ("EDGE_PORT" , "4566" ),
55
+ MaxPayloadSize : GetenvWithDefault ("LOCALSTACK_MAX_PAYLOAD_SIZE" , "6291556" ),
53
56
// optional or empty
54
57
CodeArchives : os .Getenv ("LOCALSTACK_CODE_ARCHIVES" ),
55
58
HotReloadingPaths : strings .Split (GetenvWithDefault ("LOCALSTACK_HOT_RELOADING_PATHS" , "" ), "," ),
@@ -77,6 +80,7 @@ func UnsetLsEnvs() {
77
80
"LOCALSTACK_INIT_LOG_LEVEL" ,
78
81
"LOCALSTACK_POST_INVOKE_WAIT_MS" ,
79
82
"LOCALSTACK_FUNCTION_ACCOUNT_ID" ,
83
+ "LOCALSTACK_MAX_PAYLOAD_SIZE" ,
80
84
81
85
// Docker container ID
82
86
"HOSTNAME" ,
@@ -128,6 +132,13 @@ func main() {
128
132
log .Fatal ("Invalid value for LOCALSTACK_INIT_LOG_LEVEL" )
129
133
}
130
134
135
+ // patch MaxPayloadSize
136
+ payloadSize , err := strconv .Atoi (lsOpts .MaxPayloadSize )
137
+ if err != nil {
138
+ log .Panicln ("Please specify a number for LOCALSTACK_MAX_PAYLOAD_SIZE" )
139
+ }
140
+ interop .MaxPayloadSize = payloadSize
141
+
131
142
// enable dns server
132
143
dnsServerContext , stopDnsServer := context .WithCancel (context .Background ())
133
144
go RunDNSRewriter (lsOpts , dnsServerContext )
0 commit comments