diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 74f256df..c45e9220 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -71,7 +71,7 @@ jobs: - name: Make env: RUN_LONG_TESTS: 'yes' - AZURE_STORAGE_ENDPOINT: "127.0.0.1:10000" + AZURE_STORAGE_ENDPOINT: "http://127.0.0.1:10000/devstoreaccount1" AZURE_STORAGE_ACCOUNT: "devstoreaccount1" AZURE_STORAGE_ACCESS_KEY: "Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==" run: | diff --git a/azure/public.go b/azure/public.go index 4c2b81af..ae349410 100644 --- a/azure/public.go +++ b/azure/public.go @@ -5,7 +5,6 @@ import ( "encoding/hex" "fmt" "io" - "net" "net/http" "net/url" "os" @@ -30,22 +29,6 @@ var ( _ aptly.PublishedStorage = (*PublishedStorage)(nil) ) -func isEmulatorEndpoint(endpoint string) bool { - if h, _, err := net.SplitHostPort(endpoint); err == nil { - endpoint = h - } - if endpoint == "localhost" { - return true - } - // For IPv6, there could be case where SplitHostPort fails for cannot finding port. - // In this case, eliminate the '[' and ']' in the URL. - // For details about IPv6 URL, please refer to https://tools.ietf.org/html/rfc2732 - if endpoint[0] == '[' && endpoint[len(endpoint)-1] == ']' { - endpoint = endpoint[1 : len(endpoint)-1] - } - return net.ParseIP(endpoint) != nil -} - // NewPublishedStorage creates published storage from Azure storage credentials func NewPublishedStorage(accountName, accountKey, container, prefix, endpoint string) (*PublishedStorage, error) { credential, err := azblob.NewSharedKeyCredential(accountName, accountKey) @@ -54,15 +37,10 @@ func NewPublishedStorage(accountName, accountKey, container, prefix, endpoint st } if endpoint == "" { - endpoint = "blob.core.windows.net" + endpoint = fmt.Sprintf("https://%s.blob.core.windows.net", accountName) } - var url *url.URL - if isEmulatorEndpoint(endpoint) { - url, err = url.Parse(fmt.Sprintf("http://%s/%s/%s", endpoint, accountName, container)) - } else { - url, err = url.Parse(fmt.Sprintf("https://%s.%s/%s", accountName, endpoint, container)) - } + url, err := url.Parse(fmt.Sprintf("%s/%s", endpoint, container)) if err != nil { return nil, err } diff --git a/man/aptly.1.ronn.tmpl b/man/aptly.1.ronn.tmpl index df49404a..2e4ee07b 100644 --- a/man/aptly.1.ronn.tmpl +++ b/man/aptly.1.ronn.tmpl @@ -96,8 +96,8 @@ Configuration file is stored in JSON format (default values shown below): "accountName": "", "accountKey": "", "container": "repo", - "prefix": "" - "endpoint": "blob.core.windows.net" + "prefix": "", + "endpoint": "" } } }