Skip to content
Michael J. Ryan edited this page May 20, 2015 · 3 revisions

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.

Configuration Options

When you utilize this module, you will rely on either passed in options, or environment variables.

var azureUtil = require('azure-config-util')(options);

Configuration Table

Configuration values will be determined and deconstructed from a configured table.

Instance Methods

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 Section of storage, where default is 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,key as 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 wrapper

Promise resolves to the azure-storage-simple wrapper for Azure Storage Blob (block access).

let someBlob = await azureUtil.blob('someBlob'); // simple wrapper

Promise resolves to the azure-storage-simple wrapper for Azure Storage Queue access.

let someQueue = await azureUtil.queue('someQueue'); // simple wrapper

Promise resolves to the azure-storage-simple wrapper for Azure Storage Table access.

let someTable = await azureUtil.table('someTable'); // simple wrapper

Promise 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}
`;

Clone this wiki locally