sweet-azure
A short, secured, and easy way to use Azure Storage.
Server side
This module provides the following :
- SweetAzure.Storage
- SweetAzure.Logger
Installation
$ npm install sweet-azure
Configuration
You may use environment variables to configure SweetAzure. Here is an example of .env file to set up your dev environment using dotenv :
SWEETAZURE_STORAGE_STORAGE_ACCOUNT=your_storage_account_nameSWEETAZURE_STORAGE_ACCESS_KEY=the_access_key_of_your_storage_accountSWEETAZURE_STORAGE_CONTAINER_NAME=the_name_of_the_container_you_want_sweet-azure_to_work_onSWEETAZURE_STORAGE_SAS_EXPIRY_TIME_IN_MINUTES=duration_of_validity_of_sas_generated_by_sweet-azureSWEETAZURE_LOGGER_FIREBASE_URL=https://youraccount.firebaseio.com/lognode
NB : You may reference this .env file in your .gitignore, and define environment variables for production using Azure Portal
API
var SweetAzure = ;
SweetAzure.Storage
Provides features to upload files to Azure Blob Storage using SAS. Basic example :
var express = SweetAzure = Storage = SweetAzureStorage; var app = ; console;Storage;
SweetAzure.Logger
Provides several loggers.
SweetAzure.Logger.Configurations.newFirebase(settings)
This logger enables you to log directly to Firebase. This is espacially useful if you don't have access to standard output (with Azure Mobile Services for example)
settings.firebaseUrl : (optional) the URL of your firebase node. Defaults to process.env.SWEETAZURE_LOGGER_FIREBASE_URL;
settings.firebaseReference : (optional) an initialised firebase node.
settings.enable = (optional) a boolean. Defaults to process.env.SWEETAZURE_LOGGER_FIREBASE_ENABLE or true;
Common use :
'use strict'; var dotenv = ;dotenv; var SweetAzure = Logger = SweetAzureLogger; // Create a logger using environment variables :var logger = LoggerConfigurations;logger; // or overriding environment variables by supplying settings :var logger2 = LoggerConfigurations;logger2;
Then you may want to set up Security & Rules of Firebase to make sure that nobody except you can read the data that you are logging:
Client side
Not available yet (still testing).
Installation
Install it using bower :
$ bower install sweet-azure
Then load it in your browser :
or require it :
var SweetAzure = ;
API
With AngularJS
If AngularJS is not used on the page, SweetAzure relies on Kriskowal's promises and on jQuery. It may define itself using RequireJS, SES, CommonJS, or as a global variable called SweetAzure.
SweetAzure;SweetAzure
Without AngularJS
If AngularJS is used on the page, SweetAzure does not declare itself as a global variable, but makes itself available as an AngularJS module called SweetAzure.
angular;