Skip to content

Commit b87f634

Browse files
committed
check for valid aws session
1 parent 6f22637 commit b87f634

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

cmd/awslambdaproxy/setup.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
package awslambdaproxy
22

33
import (
4-
"fmt"
5-
"os"
4+
"log"
65

76
"github.com/dan-v/awslambdaproxy/pkg/server"
87
"github.com/spf13/cobra"
@@ -11,13 +10,16 @@ import (
1110
// setupCmd represents the setup command
1211
var setupCmd = &cobra.Command{
1312
Use: "setup",
14-
Short: "Setup awslambdaproxy AWS infrastructure",
15-
Long: `This will setup all required AWS infrastructure to run awslambdaproxy.`,
13+
Short: "setup awslambdaproxy aws infrastructure",
14+
Long: `this will setup all required aws infrastructure to run awslambdaproxy.`,
1615
Run: func(cmd *cobra.Command, args []string) {
16+
if _, err := server.GetSessionAWS(); err != nil {
17+
log.Fatal("unable to find valid aws credentials")
18+
}
19+
1720
err := server.SetupLambdaInfrastructure()
1821
if err != nil {
19-
fmt.Print("Failed to run setup for awslambdaproxy: ", err)
20-
os.Exit(1)
22+
log.Fatal("failed to run setup for awslambdaproxy: ", err)
2123
}
2224
},
2325
}

0 commit comments

Comments
 (0)