Example #1
0
app.post('/rank', upload.array(), function (req, res) {


    var state = {
        originResponse: res,
        originPokemon: req.body,
        consulClient: consul(),
        slat: req.query.slat,
        slng: req.query.slng
    }
	
	console.log(state);
	if(state.originPokemon == null)
	{
	state.originResponse.status(503).send("OriginPokemon was null");
	}
	else
	{
	
	
    state.uberReqs = state.originPokemon.map(function(obj){
     return { requestId: obj.id, dlat: obj.position.lat, dlng : obj.position.lng };
    });
    console.log('GET /rank');
    state.consulClient.catalog.service.nodes('pokedash-uberestimate', lookupPokeDashUberestimate.bind(undefined, state));
	}
});
Example #2
0
function getConsulClient( options ) {
	var client = consul( options );
	var lifted;
	_.each( toLift, function( path ) {
		lifted = lift( _get( client, path ) );
		_set( client, path, lifted );
	} );
	return client;
}
Example #3
0
module.exports = function( _config ) {
	var consul = consulFactory( _config );

	_.each( toLift, function( methods, key ) {
		_.each( methods, function( m ) {
			consul[ key ][ m ] = lift( consul[ key ][ m ] );
		} );
	} );

	return consul;
};
Example #4
0
app.get('/tap', function (req, res) {

    req.body.id
    var state = {
        originResponse: res,
        uberRequestInfo : [{requestId:0,
        dlat: req.query.dlat,
        dlng: req.query.dlng}],
        slat: req.query.slat,
        slng: req.query.slng,
        consulClient: consul()

    }
    state.consulClient.catalog.service.nodes('pokedash-uberestimate', lookupPokeDashUberPoke.bind(undefined, state));

});
Example #5
0
function getPoll(req, res) {
console.log('inside poll');
	



	var state = {
        originResponse: res,
        originLat: req.query.lat,
        originLng: req.query.lng,
        consulClient: consul()
    };
	
    console.log('GET /poll: lat=' + state.originLat + ', lng=' + state.originLng);
    state.consulClient.catalog.service.nodes('pokedash-scan', consulPokeDashScanCallback.bind(undefined, state));
}
Example #6
0
const vaultSecrets  = (done) => consul({}).kv.get({key: 'playground/secrets'}, done);
Example #7
0
const storeSecrets = (secrets, done) => {
  consul({}).kv.set({
    key:    'playground/secrets',
    value:  JSON.stringify(secrets)
  }, (err) => done(err, err ? null : secrets));
};
Example #8
0
const getLeader   = (wait)   => (done) => setTimeout(() => consul({}).status.leader(done), wait);
 seneca.add('init:consul_registry',function(args,done){
   consul = consulReq(options);
   done();
 });
Example #10
0
function clean(done) {
  consulClient({}).kv.del( {key: "unittest", recurse: true }, done);
}