Skip to content

Commit fa88f5d

Browse files
committed
consul
1 parent 724bfb8 commit fa88f5d

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

search.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,14 @@ module.exports = function search (options) {
2828
var url = 'http://'+elastic.host+':'+elastic.port+
2929
'/'+elastic.base+'/mod/'+msg.data.name
3030

31+
console.log('INSERT URL: '+url)
32+
3133
Wreck.post(
3234
url,
3335
{json: true, payload: seneca.util.clean(msg.data)},
3436
function (err, res, payload) {
37+
console.log(err)
38+
3539
reply(err, payload)
3640
})
3741
}
@@ -45,7 +49,11 @@ module.exports = function search (options) {
4549
var url = 'http://'+elastic.host+':'+elastic.port+
4650
'/'+elastic.base+'/_search?q='+encodeURIComponent(msg.query)
4751

52+
console.log('SEARCH URL: '+url)
53+
4854
Wreck.get(url, {json: true}, function (err, res, payload) {
55+
console.log(err)
56+
4957
if( err ) return reply(err)
5058

5159
var qr = payload

srv/search-prod.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
/* Copyright (c) 2014-2017 Richard Rodger and other contributors, MIT License */
22

3-
var BASES = process.env.BASES.split(',')
3+
//var BASES = process.env.BASES.split(',')
44
var ELASTIC = process.env.ELASTIC_SERVICE_HOST || 'localhost'
5+
var CONSUL = process.env.CONSUL_SERVICE_HOST || 'localhost'
56

67
var Seneca = require('seneca')
78

@@ -14,11 +15,20 @@ Seneca({tag: 'search'})
1415
}
1516
})
1617

18+
.use('consul-registry', {
19+
host: CONSUL
20+
})
21+
1722
.use('mesh', {
1823
pin: 'role:search',
19-
bases: BASES,
24+
//bases: BASES,
2025
host: '@eth0',
21-
sneeze: {silent:false}
26+
//sneeze: {silent:false},
27+
discover: {
28+
registry: {
29+
active: true
30+
}
31+
},
2232
})
2333

2434
.ready(function () {

0 commit comments

Comments
 (0)