Skip to content

Commit

Permalink
Fix region and profile parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
daaru00 committed Nov 29, 2020
1 parent f11ea5b commit f0a9622
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions cmd/ssm/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ type Config struct {
}
}

// Global config
var globalConfig Config

// Commands - Return all commands
Expand All @@ -27,9 +26,12 @@ func Commands(globalFlags []cli.Flag) []*cli.Command {
Usage: "AWS SSM Commands",
Before: func(c *cli.Context) error {
config.LoadConfig(c.String("config"), &globalConfig)
// Store args into config, child commands cannot access it
globalConfig.Region = c.String("region")
globalConfig.Profile = c.String("profile")
if len(c.String("region")) > 0 {
globalConfig.Region = c.String("region")
}
if len(c.String("profile")) > 0 {
globalConfig.Profile = c.String("profile")
}
return nil
},
Flags: globalFlags,
Expand Down

0 comments on commit f0a9622

Please sign in to comment.