Socket
Socket
Sign inDemoInstall

microgateway-config

Package Overview
Dependencies
160
Maintainers
5
Versions
69
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.1.5 to 3.1.6

8

index.js

@@ -7,2 +7,3 @@ 'use strict';

var os = require('os')
const RedisClientLib = require('./lib/redisClient');

@@ -54,4 +55,11 @@ module.exports = function(){

networkInstance.setConsoleLogger(consoleLogger);
},
getRedisClient:function(config, cb){
/**
* Returns a new redis connection object.
* @param config object with redisHost, redisPort, redisDb and retryEnabled
*/
return new RedisClientLib(config, cb);
}
};
}();

@@ -236,2 +236,9 @@ 'use strict';

if (config.accesscontrol) {
if(config.accesscontrol.noRuleMatchAction){
assert(typeof config.accesscontrol.noRuleMatchAction === 'string', 'config.accesscontrol.noRuleMatchAction is not an string');
}
}
return configObject;

@@ -238,0 +245,0 @@ };

48

lib/network.js

@@ -148,5 +148,2 @@ 'use strict';

if ( process.env.EDGEMICRO_REDIS_PASSWORD ) { // override redisPassword value
config.edgemicro['redisPassword'] = process.env.EDGEMICRO_REDIS_PASSWORD;
}

@@ -406,18 +403,31 @@ // initiate an immediate load, and setup retries if it fails

function(cb) {
var opts = _.clone(options);
opts['url'] = config.edge_config.jwk_public_keys || null;
opts = enableTLS(config, opts);
request.get(opts, function(err, response, body) {
if (response && response.statusCode === 200) {
_loadStatus('jwk_public_keys', opts['url'],
err, response, body, cb);
} else {
response = {};
response.statusCode = 200;
body = null;
err = null;
_loadStatus('jwk_public_keys', opts['url'],
null, response, body, cb);
}
});
if(!config.edge_config.jwk_public_keys){
return cb(null,null);
}
if ( useSynchronizer || !config.edge_config.redisBasedConfigCache ) {
var opts = _.clone(options);
opts['url'] = config.edge_config.jwk_public_keys;
opts = enableTLS(config, opts);
request.get(opts, function(err, response, body) {
if(useSynchronizer && !err && response && response.statusCode === 200){
saveConfigToRedis(redisClient, globalOptions, config.edge_config.jwk_public_keys, body, 'jwk_public_keys', (err)=>{
if ( err ) {
writeConsoleLog('error',{component: CONSOLE_LOG_TAG_COMP}, 'error saving data to redis from %s', config.edge_config.jwk_public_keys, err);
return;
}
writeConsoleLog('info',{component: CONSOLE_LOG_TAG_COMP}, 'Saved data to redis from %s', config.edge_config.jwk_public_keys);
});
}
if ( !config.edge_config.redisBasedConfigCache) {
_loadStatus('jwk_public_keys', config.edge_config.jwk_public_keys, err, response, body, cb);
}
});
}
if ( config.edge_config.redisBasedConfigCache === true ) { //retrieve info from redis db
getConfigFromRedis(redisClient, globalOptions, config.edge_config.jwk_public_keys, 'jwk_public_keys', function(err, body){
const response = err ? null : { statusCode: 200, statusMessage: 'Downloaded from redis' };
_loadStatus('jwk_public_keys', config.edgemicro.redisHost, err, response, body, cb);
});
}
}

@@ -424,0 +434,0 @@ ], function(err, results) {

@@ -8,3 +8,4 @@ var redis = require("redis");

* connects to redis db and initialize redisClient
* @param config object which has host, port and db index for redis.
* @param config object which has host, port and db index for redis.
* To enable retry connections set retryEnabled in config with value true.
*/

@@ -16,13 +17,18 @@ const redisClientConnection = function(config, cb) {

let options = {
retry_strategy: function (options) { // to avoid multiple retry attempts
let options = {};
if ( !config.retryEnabled ) {
options.retry_strategy = function (options) { // to avoid multiple retry attempts return undefined
return undefined;
}
};
}
if ( config.redisPassword ) {
options['auth_pass'] = config.redisPassword;
}
debug('creating redisClient with port: %d, host: %s, db index: %d and options: %j ', port, host,db, options);
if ( process.env.EDGEMICRO_REDIS_PASSWORD ) { // override redisPassword value
options['auth_pass'] = process.env.EDGEMICRO_REDIS_PASSWORD;
}
debug('creating redisClient with port: %d, host: %s and db index: %d', port, host,db);
this.redisClient = redis.createClient( port, host, options );

@@ -29,0 +35,0 @@ this.redisClient.select(db);

{
"name": "microgateway-config",
"version": "3.1.5",
"version": "3.1.6",
"description": "Apigee Microgateway Handler",

@@ -12,3 +12,3 @@ "main": "index.js",

"dependencies": {
"apigeetool": "^0.10.0",
"apigeetool": "^0.14.2",
"async": "^1.5.2",

@@ -15,0 +15,0 @@ "body-parser": "^1.15.0",

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc