Skip to content

Commit

Permalink
Always check env when building HCP Client (#673)
Browse files Browse the repository at this point in the history
  • Loading branch information
dadgar authored Nov 14, 2023
1 parent 0ca1f76 commit 98b1d6b
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions internal/clients/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,11 @@ type ClientConfig struct {
// NewClient creates a new Client that is capable of making HCP requests
func NewClient(config ClientConfig) (*Client, error) {
// Build the HCP Config options
var opts []hcpConfig.HCPConfigOption
opts := []hcpConfig.HCPConfigOption{hcpConfig.FromEnv()}
if config.ClientID != "" && config.ClientSecret != "" {
opts = append(opts, hcpConfig.WithClientCredentials(config.ClientID, config.ClientSecret))
} else if config.CredentialFile != "" {
opts = append(opts, hcpConfig.WithCredentialFilePath(config.CredentialFile))
} else {
opts = append(opts, hcpConfig.FromEnv())
}

// Create the HCP Config
Expand Down

0 comments on commit 98b1d6b

Please sign in to comment.