add default setting values

This commit is contained in:
2016-04-14 17:00:50 -07:00
parent 981bf09aab
commit d0abad344a
2 changed files with 7 additions and 7 deletions

View File

@@ -28,6 +28,7 @@
"sinon": "~1.17.3"
},
"dependencies": {
"elasticsearch": "~11.0.1"
"elasticsearch": "~11.0.1",
"lodash": "~4.11.1"
}
}

View File

@@ -1,5 +1,6 @@
import events from 'events';
import createClient from './helpers/create_client';
import { omit } from 'lodash';
export default class Elastique extends events.EventEmitter {
constructor(options = {}) {
@@ -7,12 +8,10 @@ export default class Elastique extends events.EventEmitter {
super();
this.ready = true;
this.settings = {};
Object.keys(options, (key) => {
if (key !== 'client') this.settings[key] = options[key];
});
this.settings = Object.assign({
interval: '1w',
timeout: 10000,
}, omit(options, [ 'client' ]));
this.client = createClient(options.client);
}