Skip to content
This repository has been archived by the owner on Jan 18, 2024. It is now read-only.

passing values via options file seems to skip sourceHost, sourcePort options #74

Closed
mpcarl opened this issue Sep 17, 2014 · 2 comments
Closed
Assignees
Labels
Milestone

Comments

@mpcarl
Copy link
Contributor

mpcarl commented Sep 17, 2014

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

@mallocator mallocator added the bug label Sep 18, 2014
@mallocator mallocator added this to the 1.3.4 milestone Sep 18, 2014
@mallocator mallocator self-assigned this Sep 18, 2014
@mallocator
Copy link
Owner

Try this latest change, that should take care of it

@mallocator mallocator modified the milestones: 1.3.4, 1.4.0 Sep 18, 2014
@mpcarl
Copy link
Contributor Author

mpcarl commented Sep 18, 2014

That did it, thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants