Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// To run:
// $ node base.js
var HOST = process.env.HOST || process.argv[2]
var BASES = (process.env.BASES || process.argv[3] || '').split(',')
var PORT = process.env.PORT
var BROADCAST = process.env.BROADCAST
var REGISTRY = JSON.parse(process.env.REGISTRY || '{"active":false}')
require('seneca')({ tag: 'b0', legacy: {transport: false} })
.test()
.use('consul-registry', REGISTRY || {})
.use('..', {
monitor: true,
isbase: true,
host: HOST,
port: PORT,
bases: BASES,
discover: {
multicast: {
address: BROADCAST
},
registry: REGISTRY
},
dumpnet: false,
sneeze: {
// To run:
// $ node service-foo.js
var HOST = process.env.HOST || process.argv[2]
var BASES = (process.env.BASES || process.argv[3] || '').split(',')
var BROADCAST = process.env.BROADCAST
var REGISTRY = JSON.parse(process.env.REGISTRY || '{"active":false}')
require('seneca')({ tag: 'foo', legacy: {transport: false} })
.test()
.add('foo:1', function(msg, done) {
done(null, { x: 1, v: 100 + msg.v })
})
.add('zed:1', function(msg, done) {
done(null, { z: 1, f: 1, v: 100 + msg.v })
})
.add('zed:1,q:1', function(msg, done) {
done(null, { z: 1, f: 1, q:1, v: 100 + msg.v })
})
.use('consul-registry', REGISTRY || {})
.use('..', {
pin: 'foo:1',
host: HOST,
bases: BASES,
override:true,
// To run:
// $ node service-foo.js
var HOST = process.env.HOST || process.argv[2]
var BASES = (process.env.BASES || process.argv[3] || '').split(',')
var BROADCAST = process.env.BROADCAST
var REGISTRY = JSON.parse(process.env.REGISTRY || '{"active":false}')
require('seneca')({ tag: 'bar', legacy: {transport: false} })
.test()
.add('bar:1', function(msg, done) {
done(null, { y: 1, v: 100 + msg.v })
})
.add('zed:1', function(msg, done) {
done(null, { z: 2, v: 100 + msg.v })
})
.use('consul-registry', REGISTRY || {})
.use('..', {
listen:[
{pin: 'bar:1'},
{pin: 'zed:1'},
],
host: HOST,
bases: BASES,
discover: {