@live-change/elasticsearch-plugin 0.1.1 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +9 -8
- package/lib/process.js +3 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -5,23 +5,24 @@ const searchIndex = require('./lib/searchIndex.js')
|
|
|
5
5
|
const indexProcess = require('./lib/process.js')
|
|
6
6
|
|
|
7
7
|
module.exports = function(app, services) {
|
|
8
|
+
const env = process.env
|
|
8
9
|
app.connectToSearch = () => {
|
|
9
|
-
if(!
|
|
10
|
+
if(!env.SEARCH_INDEX_PREFIX) throw new Error("ElasticSearch not configured")
|
|
10
11
|
if(app.search) return app.search
|
|
11
|
-
app.searchIndexPrefix =
|
|
12
|
-
app.search = new ElasticSearch({ node:
|
|
12
|
+
app.searchIndexPrefix = env.SEARCH_INDEX_PREFIX
|
|
13
|
+
app.search = new ElasticSearch({ node: env.SEARCH_URL || 'http://localhost:9200' })
|
|
13
14
|
//this.search.info(console.log)
|
|
14
15
|
return app.search
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
app.connectToAnalytics = () => {
|
|
18
|
-
if(!
|
|
19
|
+
if(!env.ANALYTICS_INDEX_PREFIX) throw new Error("ElasticSearch analytics not configured")
|
|
19
20
|
if(app.analytics) return app.analytics
|
|
20
|
-
app.analytics = new AnalyticsWriter(
|
|
21
|
+
app.analytics = new AnalyticsWriter(env.ANALYTICS_INDEX_PREFIX)
|
|
21
22
|
return app.analytics
|
|
22
23
|
}
|
|
23
24
|
|
|
24
|
-
if(
|
|
25
|
-
if(
|
|
26
|
-
if(
|
|
25
|
+
if(env.SEARCH_INDEX_PREFIX) app.defaultProcessors.push(searchIndex)
|
|
26
|
+
if(env.SEARCH_INDEX_PREFIX) app.defaultUpdaters.push(updater)
|
|
27
|
+
if(env.SEARCH_INDEX_PREFIX) app.defaultProcesses.push(indexProcess)
|
|
27
28
|
}
|
package/lib/process.js
CHANGED