UNPKG

storage-mule

Version:

The Realtime Framework Cloud Storage Mule utility

48 lines (37 loc) 1.06 kB
/** @project StorageMule @author Realtime.co Framework team @version 1.0.0 @description */ var DEFAULT_ORTC_CLUSTER = "http://ortc-storage.realtime.co/server/2.1"; var DEFAULT_DEBUG_CHANNEL = "chDebug"; module.exports = function(opts) { if(!opts){ throw new Error('Module needs to be initialized with options.'); } if(!opts.applicationKey){ throw new Error('Module needs to be initialized with Realtime.co applicationKey'); } if(!opts.authenticationToken){ opts.authenticationToken = 'nope'; } if(opts.onException && typeof(opts.onException) !== 'function'){ opts.onException = null; //we accept only functions for onException } if(!opts.ortcCluster){ opts.ortcCluster = DEFAULT_ORTC_CLUSTER; } if(!opts.debugChannel){ opts.debugChannel = DEFAULT_DEBUG_CHANNEL; } opts.scope = {}; opts.scope.ortc = require("./src/utils/OrtcClient.js"); opts.scope.ortc.init(opts); var muleId = opts.muleId || ''; return { muleId: muleId, log: require("./src/fLog.js")(opts), Realtime: require("./src/Realtime.js")(opts) } };