-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add APPPACK_ACCOUNT env variable (#69)
- Loading branch information
1 parent
b1c030b
commit cf06763
Showing
9 changed files
with
57 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,7 @@ import ( | |
"github.com/apppackio/apppack/stacks" | ||
"github.com/apppackio/apppack/stringslice" | ||
"github.com/apppackio/apppack/ui" | ||
"github.com/apppackio/apppack/utils" | ||
"github.com/aws/aws-sdk-go/aws" | ||
"github.com/aws/aws-sdk-go/aws/session" | ||
"github.com/spf13/cobra" | ||
|
@@ -107,7 +108,7 @@ var accessCmd = &cobra.Command{ | |
Short: "list users with access to the app", | ||
Args: cobra.NoArgs, | ||
DisableFlagsInUseLine: true, | ||
Run: func(cmd *cobra.Command, args []string) { | ||
Run: func(_ *cobra.Command, _ []string) { | ||
ui.StartSpinner() | ||
var err error | ||
sess, err := adminSession(SessionDurationSeconds) | ||
|
@@ -131,7 +132,7 @@ Updates the application Cloudformation stack to add access for the user.`, | |
DisableFlagsInUseLine: true, | ||
Args: cobra.MinimumNArgs(1), | ||
Example: "apppack -a my-app access add [email protected] [email protected]", | ||
Run: func(cmd *cobra.Command, args []string) { | ||
Run: func(_ *cobra.Command, args []string) { | ||
for _, email := range args { | ||
if !validateEmail(email) { | ||
checkErr(fmt.Errorf("%s does not appear to be a valid email address", email)) | ||
|
@@ -163,7 +164,7 @@ Updates the application Cloudformation stack to remove access for the user.`, | |
DisableFlagsInUseLine: true, | ||
Args: cobra.MinimumNArgs(1), | ||
Example: "apppack -a my-app access remove [email protected] [email protected]", | ||
Run: func(cmd *cobra.Command, args []string) { | ||
Run: func(_ *cobra.Command, args []string) { | ||
for _, email := range args { | ||
if !validateEmail(email) { | ||
checkErr(fmt.Errorf("%s does not appear to be a valid email address", email)) | ||
|
@@ -195,7 +196,7 @@ func init() { | |
"account", | ||
"c", | ||
"", | ||
"AWS account ID or alias (not needed if you are only the administrator of one account)", | ||
utils.AccountFlagHelpText, | ||
) | ||
accessCmd.PersistentFlags().BoolVar( | ||
&UseAWSCredentials, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,7 @@ import ( | |
"github.com/apppackio/apppack/stacks" | ||
"github.com/apppackio/apppack/stringslice" | ||
"github.com/apppackio/apppack/ui" | ||
"github.com/apppackio/apppack/utils" | ||
"github.com/aws/aws-sdk-go/aws/session" | ||
"github.com/spf13/cobra" | ||
) | ||
|
@@ -57,7 +58,7 @@ var adminsCmd = &cobra.Command{ | |
Long: "*Requires admin permissions.*", | ||
Args: cobra.NoArgs, | ||
DisableFlagsInUseLine: true, | ||
Run: func(cmd *cobra.Command, args []string) { | ||
Run: func(_ *cobra.Command, _ []string) { | ||
ui.StartSpinner() | ||
sess, err := adminSession(SessionDurationSeconds) | ||
checkErr(err) | ||
|
@@ -78,7 +79,7 @@ var adminsAddCmd = &cobra.Command{ | |
DisableFlagsInUseLine: true, | ||
Args: cobra.MinimumNArgs(1), | ||
Example: "apppack admins add [email protected] [email protected]", | ||
Run: func(cmd *cobra.Command, args []string) { | ||
Run: func(_ *cobra.Command, args []string) { | ||
for _, email := range args { | ||
if !validateEmail(email) { | ||
checkErr(fmt.Errorf("%s does not appear to be a valid email address", email)) | ||
|
@@ -108,7 +109,7 @@ var adminsRemoveCmd = &cobra.Command{ | |
Updates the application Cloudformation stack to remove an administrators.`, | ||
DisableFlagsInUseLine: true, | ||
Args: cobra.MinimumNArgs(1), | ||
Run: func(cmd *cobra.Command, args []string) { | ||
Run: func(_ *cobra.Command, args []string) { | ||
for _, email := range args { | ||
if !validateEmail(email) { | ||
checkErr(fmt.Errorf("%s does not appear to be a valid email address", email)) | ||
|
@@ -137,7 +138,7 @@ func init() { | |
"account", | ||
"c", | ||
"", | ||
"AWS account ID or alias (not needed if you are only the administrator of one account)", | ||
utils.AccountFlagHelpText, | ||
) | ||
adminsCmd.PersistentFlags().BoolVar( | ||
&UseAWSCredentials, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package utils | ||
|
||
var AccountFlagHelpText string = "AWS account ID or alias. Use this flag to override the APPPACK_ACCOUNT environment variable (not needed if you are the administrator of only one account)." |