mirror of
https://github.com/restic/restic.git
synced 2024-12-21 23:33:03 +00:00
Merge pull request #5141 from richgrov/missing-azure-env-error
Return error if AZURE_ACCOUNT_NAME not set
This commit is contained in:
commit
2f0049cd6c
2 changed files with 12 additions and 0 deletions
7
changelog/unreleased/pull-5141
Normal file
7
changelog/unreleased/pull-5141
Normal file
|
@ -0,0 +1,7 @@
|
|||
Enhancement: Provide clear error message if AZURE_ACCOUNT_NAME is not set
|
||||
|
||||
If AZURE_ACCOUNT_NAME is not set, any command related to an Azure repository
|
||||
would result in a misleading networking error. Restic will now detect this and
|
||||
provide a clear warning that the variable is not defined.
|
||||
|
||||
https://github.com/restic/restic/pull/5141
|
|
@ -62,6 +62,11 @@ func open(cfg Config, rt http.RoundTripper) (*Backend, error) {
|
|||
} else {
|
||||
endpointSuffix = "core.windows.net"
|
||||
}
|
||||
|
||||
if cfg.AccountName == "" {
|
||||
return nil, errors.Fatalf("unable to open Azure backend: Account name ($AZURE_ACCOUNT_NAME) is empty")
|
||||
}
|
||||
|
||||
url := fmt.Sprintf("https://%s.blob.%s/%s", cfg.AccountName, endpointSuffix, cfg.Container)
|
||||
opts := &azContainer.ClientOptions{
|
||||
ClientOptions: azcore.ClientOptions{
|
||||
|
|
Loading…
Reference in a new issue