Skip to content

Commit 2710576

Browse files
committed
update a few cleanups
Signed-off-by: Wiard van Rij <[email protected]>
1 parent 45a0c3f commit 2710576

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

pkg/objstore/azure/azure.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ func parseConfig(conf []byte) (Config, error) {
147147
}
148148

149149
// If we don't have config specific retry values but we do have the generic MaxRetries.
150-
// This is part backwards compatibility but also ease of configuration
150+
// This is for backwards compatibility but also ease of configuration.
151151
if config.MaxRetries > 0 {
152152
if config.PipelineConfig.MaxTries == 0 {
153153
config.PipelineConfig.MaxTries = int32(config.MaxRetries)

pkg/objstore/azure/helpers.go

+6-10
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ func init() {
3535
}
3636

3737
func getAzureStorageCredentials(conf Config) (blob.Credential, error) {
38-
3938
if conf.MSIResource != "" {
40-
4139
msiConfig := auth.NewMSIConfig()
4240
msiConfig.Resource = conf.MSIResource
4341

@@ -46,23 +44,21 @@ func getAzureStorageCredentials(conf Config) (blob.Credential, error) {
4644
return nil, err
4745
}
4846

49-
// Get a new token
47+
// Get a new token.
5048
err = azureServicePrincipalToken.Refresh()
5149
if err != nil {
5250
return nil, err
5351
}
5452
token := azureServicePrincipalToken.Token()
5553

5654
return blob.NewTokenCredential(token.AccessToken, nil), nil
57-
58-
} else {
59-
credential, err := blob.NewSharedKeyCredential(conf.StorageAccountName, conf.StorageAccountKey)
60-
if err != nil {
61-
return nil, err
62-
}
63-
return credential, nil
6455
}
6556

57+
credential, err := blob.NewSharedKeyCredential(conf.StorageAccountName, conf.StorageAccountKey)
58+
if err != nil {
59+
return nil, err
60+
}
61+
return credential, nil
6662
}
6763

6864
func getContainerURL(ctx context.Context, conf Config) (blob.ContainerURL, error) {

0 commit comments

Comments
 (0)