Skip to content

Commit

Permalink
Merge pull request #5 from enebular/issue-2
Browse files Browse the repository at this point in the history
support secure link #2
  • Loading branch information
syuhei176 authored Mar 3, 2017
2 parents ef1e52c + 8b23844 commit 3461b66
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions mongodbstorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ function getFlows() {
var defer = when.defer();
var promise = null;
if(settings.flow_expired > new Date().getTime()) {
promise = getEnebularFlow('body', [], function(){}).then(function(flows) {
promise = getEnebularFlow('flow', [], function(){}).then(function(flows) {
defer.resolve(flows);
return saveFlows(flows);
}).then(function() {
Expand Down Expand Up @@ -466,8 +466,8 @@ var mongostorage = {
// enebular
function getEnebularFlow(key, defaultValue, cb) {
return when.promise(function(resolve,reject,notify) {
if(settings.enebularUrl) {
var url = settings.enebularUrl + settings.secure_link;
if(settings.secure_link) {
var url = settings.secure_link;
request.get(
{url: url, json:false},
function (err, res, body) {
Expand All @@ -482,7 +482,7 @@ function getEnebularFlow(key, defaultValue, cb) {
var data = JSON.parse(body);
if(data[key]) {
if(cb) cb(data);
resolve( JSON.parse(data[key]) );
resolve( data[key] );
}else{
resolve( defaultValue );
}
Expand Down

0 comments on commit 3461b66

Please sign in to comment.