Skip to content

Commit

Permalink
Add -l <address> and -p <port> options
Browse files Browse the repository at this point in the history
  • Loading branch information
frsyuki committed May 6, 2021
1 parent 06c470c commit 21987a9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@ type PayloadBuilder interface {

func main() {
functionName := flag.String("f", "myfunction", "Lambda function name")
bind := flag.String("l", "", "HTTP listen address (default any)")
port := flag.Int("p", 8080, "HTTP listen port")
endpoint := flag.String("e", "", "Lambda API endpoint")
apiType := flag.String("t", "alb", "Gateway type (alb for ALB)")
apiType := flag.String("t", "alb", "HTTP gateway type (\"alb\" for ALB)")
albMultiValue := flag.Bool("m", false, "Enable multi-value headers. Effective only with -t alb")

flag.Usage = func() {
fmt.Println("Usage of lambda-local-proxy:")
flag.PrintDefaults()
Expand All @@ -42,7 +45,9 @@ func main() {
handler := MakeInvokeLambdaHandler(client, *functionName, pb)

http.HandleFunc("/", handler)
log.Fatal(http.ListenAndServe(":8080", nil))

listenAddress := fmt.Sprintf("%s:%d", *bind, *port)
log.Fatal(http.ListenAndServe(listenAddress, nil))
}

func MakeLambdaClient(endpoint string) *lambda.Lambda {
Expand Down

0 comments on commit 21987a9

Please sign in to comment.