mirror of
https://github.com/minio/minio.git
synced 2025-01-25 13:43:17 -05:00
Support custom endpoint for Azure remote storage tier (#19188)
This commits adds support for using the `--endpoint` arg when creating a tier of type `azure`. This is needed to connect to Azure's Gov Cloud instance. For example, ``` mc ilm tier add azure TARGET TIER_NAME \ --account-name ACCOUNT \ --account-key KEY \ --bucket CONTAINER \ --endpoint https://ACCOUNT.blob.core.usgovcloudapi.net --prefix PREFIX \ --storage-class STORAGE_CLASS ``` Prior to this, the endpoint was hardcoded to `https://ACCOUNT.blob.core.windows.net`. The docs were even explicit about this, stating that `--endpoint` is: "Required for `s3` or `minio` tier types. This option has no effect for any other value of `TIER_TYPE`." Now, if the endpoint arg is present it will be used. If not, it will fall back to the same default behavior of `ACCOUNT.blob.core.windows.net`.
This commit is contained in:
parent
e3e3d92241
commit
dfb1f39b57
@ -178,9 +178,17 @@ func newWarmBackendAzure(conf madmin.TierAzure, _ string) (*warmBackendAzure, er
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
p := azblob.NewPipeline(credential, azblob.PipelineOptions{})
|
p := azblob.NewPipeline(credential, azblob.PipelineOptions{})
|
||||||
u, err := url.Parse(fmt.Sprintf("https://%s.blob.core.windows.net", conf.AccountName))
|
var u *url.URL
|
||||||
if err != nil {
|
if conf.Endpoint != "" {
|
||||||
return nil, err
|
u, err = url.Parse(conf.Endpoint)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
u, err = url.Parse(fmt.Sprintf("https://%s.blob.core.windows.net", conf.AccountName))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
serviceURL := azblob.NewServiceURL(*u, p)
|
serviceURL := azblob.NewServiceURL(*u, p)
|
||||||
return &warmBackendAzure{
|
return &warmBackendAzure{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user