diff --git a/cmd/aws-lambda-rie/http.go b/cmd/aws-lambda-rie/http.go index be4002d..ca671d8 100644 --- a/cmd/aws-lambda-rie/http.go +++ b/cmd/aws-lambda-rie/http.go @@ -9,15 +9,21 @@ import ( log "github.com/sirupsen/logrus" ) -func startHTTPServer(ipport string, sandbox Sandbox) { +func startHTTPServer(ipport string, sandbox Sandbox, funcName string) { srv := &http.Server{ Addr: ipport, } - // Pass a channel - http.HandleFunc("/2015-03-31/functions/function/invocations", func(w http.ResponseWriter, r *http.Request) { - InvokeHandler(w, r, sandbox) - }) + var functions = []string{funcName} + if funcName != "function" { + functions = []string{"function", funcName} + } + for _, funcName := range functions { + // Pass a channel + http.HandleFunc("/2015-03-31/functions/"+funcName+"/invocations", func(w http.ResponseWriter, r *http.Request) { + InvokeHandler(w, r, sandbox) + }) + } // go routine (main thread waits) if err := srv.ListenAndServe(); err != nil { diff --git a/cmd/aws-lambda-rie/main.go b/cmd/aws-lambda-rie/main.go index 3a87e46..28f36d3 100644 --- a/cmd/aws-lambda-rie/main.go +++ b/cmd/aws-lambda-rie/main.go @@ -46,7 +46,8 @@ func main() { go sandbox.Create() testAPIipport := "0.0.0.0:8080" - startHTTPServer(testAPIipport, sandbox) + funcName := GetenvWithDefault("AWS_LAMBDA_FUNCTION_NAME", "function") + startHTTPServer(testAPIipport, sandbox, funcName) } func getCLIArgs() (options, []string) {