Skip to content

Commit

Permalink
Optimize and Merge user agent appID resolving from env config
Browse files Browse the repository at this point in the history
  • Loading branch information
Tianyi Wang committed Oct 13, 2023
1 parent e3b97d2 commit cdcb681
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 5 additions & 0 deletions config/env_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,11 @@ func (c EnvConfig) getDefaultsMode(ctx context.Context) (aws.DefaultsMode, bool,
return c.DefaultsMode, true, nil
}

func (c EnvConfig) getAppID(context.Context) (string, bool, error) {
appID := os.Getenv(`AWS_SDK_UA_APP_ID`)
return appID, len(appID) > 0, nil
}

// GetRetryMaxAttempts returns the value of AWS_MAX_ATTEMPTS if was specified,
// and not 0.
func (c EnvConfig) GetRetryMaxAttempts(ctx context.Context) (int, bool, error) {
Expand Down
4 changes: 0 additions & 4 deletions config/resolve.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,6 @@ func resolveAppID(ctx context.Context, cfg *aws.Config, configs configs) error {
return err
}

// if app ID is set in env var, it should precedence shared config value
if appID := os.Getenv(`AWS_SDK_UA_APP_ID`); len(appID) > 0 {
ID = appID
}
cfg.AppID = ID
return nil
}
Expand Down

0 comments on commit cdcb681

Please sign in to comment.