From 47bc47508c916c92e344f12eaa62adfc69b2e019 Mon Sep 17 00:00:00 2001 From: Mahesh Kalappattil Date: Thu, 17 Aug 2023 14:24:56 -0700 Subject: [PATCH] added support for specifying AWS profile in the cloudngfwaws provider. --- client.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/client.go b/client.go index 85c2fff..5a6a516 100644 --- a/client.go +++ b/client.go @@ -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"` @@ -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 != "" { @@ -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 {