-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathgithub-prod.js
66 lines (52 loc) · 1.52 KB
/
github-prod.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/* Copyright (c) 2014-2017 Richard Rodger and other contributors, MIT License */
//var BASES = process.env.BASES.split(',')
var CONSUL = process.env.CONSUL_SERVICE_HOST || 'localhost'
var Seneca = require('seneca')
Seneca({tag: 'github'})
.use('entity')
.use('consul-registry', {
host: CONSUL
})
.use('jsonfile-store', {folder: __dirname+'/../data'})
.use('../github.js')
.add('role:info,need:part', function (msg, reply) {
reply()
this.act(
'role:github,cmd:get', {name:msg.name},
function (err, mod) {
if (err) return
if (mod) {
return this.act('role:info,collect:part,part:github',
{name:msg.name,data:this.util.clean(mod.data$())})
}
this.act(
'role:npm,cmd:get', {name:msg.name},
function (err, mod) {
if (err) return
if (mod) {
this.act(
'role:github,cmd:get', {name:msg.name, giturl:mod.giturl},
function( err, mod ){
if( err ) return
if( mod ) {
this.act('role:info,collect:part,part:github',
{name:msg.name,data:this.util.clean(mod.data$())})
}
})
}
})
})
})
.use('mesh', {
listen: [
{pin: 'role:github'},
{pin: 'role:info,need:part', model:'observe'}
],
//bases: BASES,
host: '@eth0',
discover: {
registry: {
active: true
}
}
})