5858 // The following arguments are deprecated which is why they are no longer documented
5959 configPath = flag .String ("config" , "" , "" )
6060 endpoint = flag .String ("endpoint" , "" , "" )
61+
62+ errConfigMerge = errors .New ("when using a configuration file, zero or all environment variables must be set" )
63+ errConfigAuthorizationConflict = errors .New ("when passing an 'Authorization' additional headers, SRC_ACCESS_TOKEN must never be set" )
6164)
6265
6366// commands contains all registered subcommands.
@@ -154,6 +157,11 @@ func readConfig() (*config, error) {
154157 }
155158
156159 cfg .AdditionalHeaders = parseAdditionalHeaders ()
160+ // Ensure that we're not clashing additonal headers
161+ _ , hasAuthorizationAdditonalHeader := cfg .AdditionalHeaders ["authorization" ]
162+ if cfg .AccessToken != "" && hasAuthorizationAdditonalHeader {
163+ return nil , errConfigAuthorizationConflict
164+ }
157165
158166 // Lastly, apply endpoint flag if set
159167 if endpoint != nil && * endpoint != "" {
@@ -168,5 +176,3 @@ func readConfig() (*config, error) {
168176func cleanEndpoint (urlStr string ) string {
169177 return strings .TrimSuffix (urlStr , "/" )
170178}
171-
172- var errConfigMerge = errors .New ("when using a configuration file, zero or all environment variables must be set" )
0 commit comments