-
Notifications
You must be signed in to change notification settings - Fork 0
Home
This module (azure-config-util) is to isolate and make available configuration settings via a centralized Azure Storage Table, as well as provide utility methods for easily accessing features of Azure Storage and SQL.
When you utilize this module, you will rely on either passed in options, or environment variables.
var azureUtil = require('azure-config-util')(options);Configuration values will be determined and deconstructed from a configured table.
Each instance method links to more detailed information
Promise resolves a deconstructed configuration object from the Azure Storage Table configured.
var cfg = await azureUtil.config();
var obj = cfg && cfg.someSection && cfg.someSection.someKey;Promise resolves to an azure-storage-simple object.
- Will use the
Sectionofstorage, wheredefaultis the same storage account used by the module. - Will lookup based on a string.
- Can pass it an Azure Storage Connection String, which will resolve the connection based on said string
- Can pass it
account,keyas to arguments, which will resolve to a connection based on said combination.
let storage = await azureUtil.storage(); //defaults to same account
var blobsvc = storage.createBlobService(); // base azure-storage service
var queuesvc = storage.createQueueService(); // base azure-storage service
var tblsvc = storage.createTableService(); // base azure-storage service
someBlob = storage.blob('someblob'); //azure-storage-simple wrapper
someQueue = storage.queue('somequeue'); // azure-storage-simple wrapper
someTable = storage.table('someTable'); //azure-storage-simple wrapperPromise resolves to the azure-storage-simple wrapper for Azure Storage Blob (block access).
let someBlob = await azureUtil.blob('someBlob'); // simple wrapperPromise resolves to the azure-storage-simple wrapper for Azure Storage Queue access.
let someQueue = await azureUtil.queue('someQueue'); // simple wrapperPromise resolves to the azure-storage-simple wrapper for Azure Storage Table access.
let someTable = await azureUtil.table('someTable'); // simple wrapperPromise resolves to an mssql-ng connection.
let bar = 12345;
let sql = await azureUtil.sql('someSqlName'); // mssql-ng
var results = sql.query`
SELECT *
FROM Foo
WHERE Bar = ${bar}
`;