Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

azureblob: allow emulator account/key override

Roel Arentse455940f7108
diff --git a/backend/azureblob/azureblob.go b/backend/azureblob/azureblob.go
index e9402ad0e..8c49a50dd 100644
--- a/backend/azureblob/azureblob.go
+++ b/backend/azureblob/azureblob.go
@@ -595,7 +595,15 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
)
switch {
case opt.UseEmulator:
- credential, err := azblob.NewSharedKeyCredential(emulatorAccount, emulatorAccountKey)
+ var actualEmulatorAccount = emulatorAccount
+ if opt.Account != "" {
+ actualEmulatorAccount = opt.Account
+ }
+ var actualEmulatorKey = emulatorAccountKey
+ if opt.Key != "" {
+ actualEmulatorKey = opt.Key
+ }
+ credential, err := azblob.NewSharedKeyCredential(actualEmulatorAccount, actualEmulatorKey)
if err != nil {
return nil, fmt.Errorf("failed to parse credentials: %w", err)
}
diff --git a/docs/content/azureblob.md b/docs/content/azureblob.md
index b9841e0e3..5a1e2663f 100644
--- a/docs/content/azureblob.md
+++ b/docs/content/azureblob.md
@@ -164,7 +164,7 @@ Here are the Standard options specific to azureblob (Microsoft Azure Blob Storag
Storage Account Name.
-Leave blank to use SAS URL or Emulator.
+Leave blank to use SAS URL.
Properties:
@@ -198,7 +198,7 @@ Properties:
Storage Account Key.
-Leave blank to use SAS URL or Emulator.
+Leave blank to use SAS URL.
Properties:
@@ -246,6 +246,8 @@ Uses local storage emulator if provided as 'true'.
Leave blank if using real azure storage endpoint.
+Provide `account`, `key`, and `endpoint` if desired to override their _azurite_ defaults.
+
Properties:
- Config: use_emulator
@@ -528,6 +530,6 @@ See [List of backends that do not support rclone about](https://rclone.org/overv
You can run rclone with storage emulator (usually _azurite_).
-To do this, just set up a new remote with `rclone config` following instructions described in introduction and set `use_emulator` config as `true`. You do not need to provide default account name neither an account key.
+To do this, just set up a new remote with `rclone config` following instructions described in introduction and set `use_emulator` config as `true`. You do not need to provide default account name neither an account key. But you can override them in the _account_ and _key_ options. (Prior to v1.61 they were hard coded to _azurite_'s `devstoreaccount1`.)
Also, if you want to access a storage emulator instance running on a different machine, you can override _Endpoint_ parameter in advanced settings, setting it to `http(s)://<host>:<port>/devstoreaccount1` (e.g. `http://10.254.2.5:10000/devstoreaccount1`).