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" "sinon": "~1.17.3"
}, },
"dependencies": { "dependencies": {
"elasticsearch": "~11.0.1" "elasticsearch": "~11.0.1",
"lodash": "~4.11.1"
} }
} }

View File

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