1
mirror of https://github.com/rclone/rclone synced 2024-11-23 00:06:55 +01:00

azureblob: allow emulator account/key override

This commit is contained in:
Roel Arents 2022-11-08 21:24:06 +01:00 committed by GitHub
parent 65528fd009
commit e455940f71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 4 deletions

View File

@ -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)
}

View File

@ -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`).