(agent) fix info_node

This commit is contained in:
Unitech 2017-02-03 15:31:56 +01:00
parent 5c7298fd15
commit 89d8b593ec
2 changed files with 12 additions and 1 deletions

View File

@ -355,9 +355,12 @@ InteractorDaemonizer.getOrSetConf = function(conf, infos, cb) {
if (process.env.PM2_PUBLIC_KEY || process.env.KEYMETRICS_PUBLIC)
public_key = process.env.PM2_PUBLIC_KEY || process.env.KEYMETRICS_PUBLIC;
if (new_connection && infos.info_node == null)
if (new_connection && info_node == null)
info_node = process.env.KEYMETRICS_NODE || cst.KEYMETRICS_ROOT_URL;
if (!info_node)
info_node = cst.KEYMETRICS_ROOT_URL;
if (!secret_key)
return cb(new Error('secret key is not defined'));

View File

@ -41,6 +41,10 @@ describe('Daemonizer interactor', function() {
}, function(err, data) {
should(err).be.null();
data.info_node.should.eql(default_conf.KEYMETRICS_ROOT_URL);
var interaction_conf = json5.parse(fs.readFileSync(default_conf.INTERACTION_CONF));
interaction_conf.info_node.should.eql(default_conf.KEYMETRICS_ROOT_URL);
return done();
});
});
@ -51,6 +55,10 @@ describe('Daemonizer interactor', function() {
data.secret_key.should.eql('xxx');
data.public_key.should.eql('yyy');
data.info_node.should.eql(default_conf.KEYMETRICS_ROOT_URL);
var interaction_conf = json5.parse(fs.readFileSync(default_conf.INTERACTION_CONF));
interaction_conf.info_node.should.eql(default_conf.KEYMETRICS_ROOT_URL);
return done();
});
});