-
Notifications
You must be signed in to change notification settings - Fork 0
GetStorageMethod
Michael J. Ryan edited this page May 21, 2015
·
1 revision
The azure-config-util object instance presents a storage(...) method that returns a promise, that will resolve to an azure-storage-simple storage instance.
This method is used by blob(name), queue(name), and table(name) to establish an azure-storage-simple connection wrapper.
-
storage(connectionString)- When passed an Azure Storage
connectionString, it will be used to create the storage instance directly.
- When passed an Azure Storage
-
storage(accountName,accountKey)- When passed an Azure Storage
accountNameandaccountKey, it will be used to create the storage instance directly.
- When passed an Azure Storage
-
storage(name)- When a name is specified, config() is used in order to determin the connection settings for the
named connection.
- When a name is specified, config() is used in order to determin the connection settings for the
-
storage()- When no name is passed, or
"default"is used (without a matchingstorage.nameconfiguration value), the storage account for the azureUtil instance is used.
- When no name is passed, or
When using a named, or "default" storage configuration, a matching Key should be present under the Section field set to "storage"
-
account- The Azure Storage Connection String, or the name of the Azure Storage Account, if different than theKeyfield. -
key- The Azure Storage Account Key, if theaccountis not set to a connection string.
| Section | Key | JsonValue |
|---|---|---|
| storage | account | {"account":"otherAccountName","key":"..."} |
| storage | account2 | {"key":"..."} |
//no string, use configured default
let default = await azureUtil.storage(); // use azureUtil's configured storage
// look for "default" key first, fallback to configured storage account
let default = await azureUtil.storage('default');default
// storage wrapper for the "otherAccountName" Azure Storage account using specified key.
let account1 = await azureUtil.storage('account');
// storage wrapper for the "account2" Azure STorage account using specified key.
let account2 = await azureUtil.storage('account2');As you should see by now, this provides a flexible means to specify azure storage connections, or by default utilize the azureUtil instance's storage account by default.