|
1 | 1 | package cmd |
2 | 2 |
|
3 | 3 | import ( |
4 | | - "github.com/spf13/cobra" |
5 | | - "os/user" |
| 4 | + "fmt" |
6 | 5 | "github.com/dan-v/awslambdaproxy" |
7 | | - "time" |
| 6 | + "github.com/spf13/cobra" |
8 | 7 | "github.com/spf13/viper" |
9 | | - "strings" |
10 | 8 | "os" |
11 | | - "fmt" |
| 9 | + "os/user" |
12 | 10 | "strconv" |
| 11 | + "strings" |
| 12 | + "time" |
13 | 13 | ) |
14 | 14 |
|
15 | 15 | var ( |
16 | | - frequency time.Duration |
17 | | - memory int64 |
| 16 | + frequency time.Duration |
| 17 | + memory int64 |
18 | 18 | sshUser, sshPort, regions, listeners string |
19 | 19 | // Max execution time on lambda is 300 seconds currently |
20 | | - lambdaMaxFrequency = time.Duration(290 * time.Second) // leave 10 seconds of leeway |
21 | | - lambdaMinMemorySize = 128 |
22 | | - lambdaMaxMemorySize = 1536 |
| 20 | + lambdaMaxFrequency = time.Duration(290 * time.Second) // leave 10 seconds of leeway |
| 21 | + lambdaMinMemorySize = 128 |
| 22 | + lambdaMaxMemorySize = 1536 |
23 | 23 | ) |
24 | 24 |
|
25 | 25 | // runCmd represents the run command |
@@ -93,19 +93,19 @@ func getCurrentUserName() string { |
93 | 93 | func init() { |
94 | 94 | RootCmd.AddCommand(runCmd) |
95 | 95 |
|
96 | | - runCmd.Flags().StringVarP(®ions, "regions", "r", "us-west-2","Regions to " + |
| 96 | + runCmd.Flags().StringVarP(®ions, "regions", "r", "us-west-2", "Regions to "+ |
97 | 97 | "run proxy.") |
98 | | - runCmd.Flags().DurationVarP(&frequency, "frequency", "f", time.Duration(time.Second * 260), "Frequency " + |
99 | | - "to execute Lambda function. Maximum is " + lambdaMaxFrequency.String() + ". If multiple " + |
100 | | - "lambda-regions are specified, this will cause traffic to rotate round robin at the interval " + |
| 98 | + runCmd.Flags().DurationVarP(&frequency, "frequency", "f", time.Duration(time.Second*260), "Frequency "+ |
| 99 | + "to execute Lambda function. Maximum is "+lambdaMaxFrequency.String()+". If multiple "+ |
| 100 | + "lambda-regions are specified, this will cause traffic to rotate round robin at the interval "+ |
101 | 101 | "specified here.") |
102 | | - runCmd.Flags().Int64VarP(&memory, "memory", "m", 128, "Memory size in MB for Lambda function. " + |
| 102 | + runCmd.Flags().Int64VarP(&memory, "memory", "m", 128, "Memory size in MB for Lambda function. "+ |
103 | 103 | "Higher memory may allow for faster network throughput.") |
104 | | - runCmd.Flags().StringVarP(&listeners, "listeners", "l", "admin:awslambdaproxy@:8080","Add as many listeners" + |
| 104 | + runCmd.Flags().StringVarP(&listeners, "listeners", "l", "admin:awslambdaproxy@:8080", "Add as many listeners"+ |
105 | 105 | "as you'd like.") |
106 | | - runCmd.Flags().StringVarP(&sshUser, "ssh-user", "", getCurrentUserName(),"SSH user for tunnel " + |
| 106 | + runCmd.Flags().StringVarP(&sshUser, "ssh-user", "", getCurrentUserName(), "SSH user for tunnel "+ |
107 | 107 | "connections from Lambda.") |
108 | | - runCmd.Flags().StringVarP(&sshPort, "ssh-port", "", "22","SSH port for tunnel " + |
| 108 | + runCmd.Flags().StringVarP(&sshPort, "ssh-port", "", "22", "SSH port for tunnel "+ |
109 | 109 | "connections from Lambda.") |
110 | 110 |
|
111 | 111 | viper.BindPFlag("regions", runCmd.Flags().Lookup("regions")) |
|
0 commit comments