Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const edgeconfig = require('microgateway-config');
const gateway = require('microgateway-core');
const reloadCluster = require('./reload-cluster');
const JsonSocket = require('../../third_party/json-socket/json-socket');
const configLocations = require('../../config/locations');
const isWin = /^win/.test(process.platform);
const ipcPath = configLocations.getIPCFilePath();
const pidPath = configLocations.getPIDFilePath();
const defaultPollInterval = 600;
const uuid = require('uuid/v1');
const debug = require('debug')('microgateway');
const jsdiff = require('diff');
const _ = require('lodash');
//const os = require('os');
const writeConsoleLog = require('microgateway-core').Logging.writeConsoleLog;
edgeconfig.setConsoleLogger(writeConsoleLog);
const Gateway = function() {};
const CONSOLE_LOG_TAG_COMP = 'microgateway gateway';
module.exports = function() {
return new Gateway();
};
// initializeMicroGatewayLogging
// All logging is initialized here.
// For logging to happend xalling initializeMicroGatewayLogging is required at some point early on in
// the flow of configuration
function initializeMicroGatewayLogging(config,options) {
// gateway from require
gateway.Logging.init(config,options);
const util = require('util');
const url = require('url');
const request = require('request');
const debug = require('debug')('edgemicro');
const async = require('async');
const crypto = require('crypto');
const _ = require('lodash');
const parser = new(require('xml2js')).Parser();
const builder = new(require('xml2js')).Builder();
const assert = require('assert');
const cert = require('./cert-lib');
const edgeconfig = require('microgateway-config');
const configLocations = require('../../config/locations');
const deploymentFx = require('./deploy-auth');
const writeConsoleLog = require('microgateway-core').Logging.writeConsoleLog;
edgeconfig.setConsoleLogger(writeConsoleLog);
const CONSOLE_LOG_TAG_COMP = 'microgateway private';
const DEFAULT_HOSTS = 'default,secure';
const Private = function() {};
module.exports = function() {
return new Private();
};
// begins edgemicro configuration process
Private.prototype.configureEdgemicro = function(options, cb) {
if (!fs.existsSync(configLocations.getDefaultPath(options.configDir))) {
writeConsoleLog('error',{component: CONSOLE_LOG_TAG_COMP},"Missing %s, Please run 'edgemicro init'", configLocations.getDefaultPath(options.configDir))
return cb("Please call edgemicro init first")
'use strict';
const request = require('request');
const util = require('util');
const fs = require('fs');
const path = require('path');
const edgeconfig = require('microgateway-config');
const jwt = require('jsonwebtoken');
const assert = require('assert')
const configLocations = require('../../config/locations');
const writeConsoleLog = require('microgateway-core').Logging.writeConsoleLog;
edgeconfig.setConsoleLogger(writeConsoleLog);
const CONSOLE_LOG_TAG_COMP = 'microgateway token';
const Token = function() {
};
module.exports = function() {
return new Token();
};
Token.prototype.decodeToken = function( options ) {
assert(options.file,"file is required")
const token = fs.readFileSync(path.resolve(options.file), 'utf8').trim();
try{
const decodedJWT = jwt.decode(token, {complete:true});
writeConsoleLog('log',{component: CONSOLE_LOG_TAG_COMP},decodedJWT);
'use strict';
const edgeconfig = require('microgateway-config');
//const path = require('path');
const request = require('request');
const async = require('async');
//const assert = require('assert');
const writeConsoleLog = require('microgateway-core').Logging.writeConsoleLog;
edgeconfig.setConsoleLogger(writeConsoleLog);
const CONSOLE_LOG_TAG_COMP = 'microgateway verify';
const configLocations = require('../../config/locations');
const agentLib = require('../../lib/agent-config');
const util = require('util');
const Verify = function () { }
module.exports = function () {
return new Verify();
}
Verify.prototype.verify = function verify(options) {
'use strict';
const cert = require('./cert-lib')
const edgeconfig = require('microgateway-config');
const util = require('util');
const configLocations = require('../../config/locations');
const assert = require('assert')
//const prompt = require('cli-prompt');
//const path = require('path');
//const apigeetool = require('apigeetool');
//const _ = require('lodash');
//const async = require('async');
const writeConsoleLog = require('microgateway-core').Logging.writeConsoleLog;
edgeconfig.setConsoleLogger(writeConsoleLog);
const CONSOLE_LOG_TAG_COMP = 'microgateway cert';
const Cert = function() {
};
module.exports = function() {
return new Cert();
};
Cert.prototype.installCert = function(options, cb) {
if ( !options.username && !options.token ) {
return options.error('username is required');
}
if ( !options.org ) {
return options.error('org is required');
'use strict';
const debug = require('debug')('edgemicro');
const async = require('async');
const crypto = require('crypto');
const _ = require('lodash');
const request = require('request');
const url = require('url')
const util = require('util');
const assert = require('assert')
const edgeconfig = require('microgateway-config');
const configLocations = require('../../config/locations');
const writeConsoleLog = require('microgateway-core').Logging.writeConsoleLog;
edgeconfig.setConsoleLogger(writeConsoleLog);
const CONSOLE_LOG_TAG_COMP = 'microgateway key gen';
const KeyGen = function() {
};
KeyGen.prototype.revoke = function(options, cb) {
const config = edgeconfig.load({
source: configLocations.getSourcePath(options.org, options.env)
});
const baseUri = config.edge_config.baseUri;
const regionUrl = util.format(baseUri, 'region', options.org, options.env);
const keys = {
key: options.key
'use strict';
const edgeconfig = require('microgateway-config')
//const prompt = require('cli-prompt');
//const path = require('path');
//const apigeetool = require('apigeetool');
//const _ = require('lodash');
const async = require('async')
const util = require('util')
const fs = require('fs')
const assert = require('assert');
const writeConsoleLog = require('microgateway-core').Logging.writeConsoleLog;
edgeconfig.setConsoleLogger(writeConsoleLog);
const configLocations = require('../../config/locations');
const BUFFERSIZE = 10000;
const BATCHSIZE = 500;
const FLUSHINTERVAL = 5000;
var defaultConfig ;
const CONSOLE_LOG_TAG_COMP = 'microgateway configure';
var certLib = require('./cert-lib')
var cert;
var deployAuthLib = require('./deploy-auth')
var deployAuth;
var authUri, managementUri, keySecretMessage, targetFile;
const Configure = function () {