add default setting values
This commit is contained in:
@@ -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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
11
src/index.js
11
src/index.js
@@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user