passing values via options file seems to skip sourceHost, sourcePort options
mpcarl opened this issue · comments
I am trying to pass in values via the options file. However, it does not appear that the options for sourceHost or sourcePort are used correctly. I made two modifications to the source...
options.js:
exports.readOptionsFile = function(opts) {
if (!opts.optionsFile){
return;
}
if (!fs.existsSync(opts.optionsFile)) {
return 'The given options file could not be found.';
}
var fileOpts = JSON.parse(fs.readFileSync(opts.optionsFile));
for (var prop in fileOpts) {
if (!opts[prop] && !exports.overrides[prop]) {
console.log("Copying property %s", prop);
opts[prop] = fileOpts[prop];
} else {
console.log("Skipping property %s", prop);
}
}
};
and es.js:
this.source = {
get: function (opts, path, callback) {
console.log("create GET source %s %s %s %s", opts.sourceUseSSL, opts.sourceHost, opts.sourcePort, opts.sourceAuth);
return create(opts.sourceHttpProxy, opts.sourceUseSSL, opts.sourceHost, opts.sourcePort, opts.sourceAuth, path, 'GET', {}, callback);
},
Running with the provided options.json:
node exporter.js -o test/data/options.json
produces this output:
mpcarl] (master) $: node exporter.js -o test/data/options.json
Elasticsearch Exporter - Version 1.3.3
Skipping property sourceHost
Skipping property sourcePort
Copying property sourceIndex
Copying property sourceType
Copying property targetHost
Copying property targetPort
Copying property targetIndex
Copying property targetType
Reading source statistics from ElasticSearch
create GET source false localhost 9200 undefined
create GET source false localhost 9200 undefined
create GET source false localhost 9200 undefined
create GET source false localhost 9200 undefined
create GET source undefined host2 9201 undefined
create GET source undefined host2 9201 undefined
create GET source undefined host2 9201 undefined
create GET source undefined host2 9201 undefined
Try this latest change, that should take care of it
That did it, thanks.