Skip to content

Commit

Permalink
added support for specifying AWS profile in the cloudngfwaws provider.
Browse files Browse the repository at this point in the history
  • Loading branch information
mkalappattil committed Aug 17, 2023
1 parent 4994ae1 commit 47bc475
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ type Client struct {
Host string `json:"host"`
AccessKey string `json:"access-key"`
SecretKey string `json:"secret-key"`
Profile string `json:"profile"`
Region string `json:"region"`
Protocol string `json:"protocol"`
Timeout int `json:"timeout"`
Expand Down Expand Up @@ -156,6 +157,15 @@ func (c *Client) Setup() error {
}
}

// Profile.
if c.Profile == "" {
if val := os.Getenv("CLOUDNGFWAWS_PROFILE"); c.CheckEnvironment && val != "" {
c.Profile = val
} else if json_client.Profile != "" {
c.Profile = json_client.Profile
}
}

// Region.
if c.Region == "" {
if val := os.Getenv("CLOUDNGFWAWS_REGION"); c.CheckEnvironment && val != "" {
Expand Down Expand Up @@ -355,6 +365,7 @@ func (c *Client) RefreshJwts(ctx context.Context) error {
Credentials: creds,
Region: aws.String(c.Region),
},
Profile: c.Profile,
})

if err != nil {
Expand Down

0 comments on commit 47bc475

Please sign in to comment.