@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 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(!app.env.SEARCH_INDEX_PREFIX) throw new Error("ElasticSearch not configured")
10
+ if(!env.SEARCH_INDEX_PREFIX) throw new Error("ElasticSearch not configured")
10
11
  if(app.search) return app.search
11
- app.searchIndexPrefix = app.env.SEARCH_INDEX_PREFIX
12
- app.search = new ElasticSearch({ node: app.env.SEARCH_URL || 'http://localhost:9200' })
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(!app.env.ANALYTICS_INDEX_PREFIX) throw new Error("ElasticSearch analytics not configured")
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(app.env.ANALYTICS_INDEX_PREFIX)
21
+ app.analytics = new AnalyticsWriter(env.ANALYTICS_INDEX_PREFIX)
21
22
  return app.analytics
22
23
  }
23
24
 
24
- if(app.env.SEARCH_INDEX_PREFIX) app.defaultProcessors.push(searchIndex)
25
- if(app.env.SEARCH_INDEX_PREFIX) app.defaultUpdaters.push(updater)
26
- if(app.env.SEARCH_INDEX_PREFIX) app.defaultUpdaters.push(indexProcess)
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
@@ -45,4 +45,6 @@ async function startSearchIndexer(service, config) {
45
45
  }
46
46
  await Promise.all(promises)
47
47
  console.log("search indexer started!")
48
- }
48
+ }
49
+
50
+ module.exports = startSearchIndexer
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/elasticsearch-plugin",
3
- "version": "0.1.1",
3
+ "version": "0.1.5",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {