File tree 1 file changed +3
-3
lines changed 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -19,9 +19,6 @@ var port = getEnv("PORT", "8080")
19
19
var rieEndpoint = getEnv ("RIE_ENDPOINT" , "http://localhost:9000/2015-03-31/functions/function/invocations" )
20
20
var enableCors = getEnv ("ENABLE_CORS" , "false" )
21
21
22
- // It is a global variable for testing.
23
- var rootHandler http.Handler
24
-
25
22
func getEnv (key , fallback string ) string {
26
23
if value , exists := os .LookupEnv (key ); exists {
27
24
return value
@@ -30,12 +27,15 @@ func getEnv(key, fallback string) string {
30
27
}
31
28
32
29
func main () {
30
+ var rootHandler http.Handler
31
+
33
32
if enableCors == "true" {
34
33
rootHandler = cors .AllowAll ().Handler (http .HandlerFunc (lambdaUrlProxyHandler ))
35
34
log .Println ("[Lambda URL Proxy] CORS enabled" )
36
35
} else {
37
36
rootHandler = http .HandlerFunc (lambdaUrlProxyHandler )
38
37
}
38
+
39
39
http .Handle ("/" , rootHandler )
40
40
log .Printf ("[Lambda URL Proxy] Listening on http://localhost:%s\n " , port )
41
41
log .Fatal (http .ListenAndServe (fmt .Sprintf (":%s" , port ), nil ))
You can’t perform that action at this time.
0 commit comments