added azure domain parameter
This commit is contained in:
parent
f96896a9c0
commit
068b115abc
5 changed files with 30 additions and 6 deletions
|
@ -53,7 +53,13 @@ func open(cfg Config, rt http.RoundTripper) (*Backend, error) {
|
|||
var client *azContainer.Client
|
||||
var err error
|
||||
|
||||
url := fmt.Sprintf("https://%s.blob.core.windows.net/%s", cfg.AccountName, cfg.Container)
|
||||
var endpointSuffix string
|
||||
if cfg.EndpointSuffix != "" {
|
||||
endpointSuffix = cfg.EndpointSuffix
|
||||
} else {
|
||||
endpointSuffix = "core.windows.net"
|
||||
}
|
||||
url := fmt.Sprintf("https://%s.blob.%s/%s", cfg.AccountName, endpointSuffix, cfg.Container)
|
||||
opts := &azContainer.ClientOptions{
|
||||
ClientOptions: azcore.ClientOptions{
|
||||
Transport: &http.Client{Transport: rt},
|
||||
|
|
|
@ -13,11 +13,12 @@ import (
|
|||
// Config contains all configuration necessary to connect to an azure compatible
|
||||
// server.
|
||||
type Config struct {
|
||||
AccountName string
|
||||
AccountSAS options.SecretString
|
||||
AccountKey options.SecretString
|
||||
Container string
|
||||
Prefix string
|
||||
AccountName string
|
||||
AccountSAS options.SecretString
|
||||
AccountKey options.SecretString
|
||||
EndpointSuffix string
|
||||
Container string
|
||||
Prefix string
|
||||
|
||||
Connections uint `option:"connections" help:"set a limit for the number of concurrent connections (default: 5)"`
|
||||
}
|
||||
|
@ -71,4 +72,7 @@ func (cfg *Config) ApplyEnvironment(prefix string) {
|
|||
if cfg.AccountSAS.String() == "" {
|
||||
cfg.AccountSAS = options.NewSecretString(os.Getenv(prefix + "AZURE_ACCOUNT_SAS"))
|
||||
}
|
||||
if cfg.EndpointSuffix == "" {
|
||||
cfg.EndpointSuffix = os.Getenv("AZURE_ENDPOINT_SUFFIX")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue