dashersw / cote

A Node.js library for building zero-configuration microservices.
http://cote.js.org
MIT License
2.35k stars 187 forks source link

there is something wrong with redis config #78

Open francislyj opened 6 years ago

francislyj commented 6 years ago

@dashersw redis.js file that.emit('message', message, { address: '0.0.0.0', port: port}); will causes the source package ip and port has error occurred. So the code needs to be improved evaluateHello function in the discover.js file ,such as if(!settings.redis){ data.address = rinfo.address; data.port = rinfo.port; },self.me should also change from address : '127.0.0.1' to address : settings.address

francislyj commented 6 years ago

the getLocalIp should be change below: `var getLocalIp = function () {

    var ifaces = os.networkInterfaces();
    var localIp = "127.0.0.1";

    Object.keys(ifaces).forEach(function (ifname) {
        ifaces[ifname].forEach(function (iface) {
            if ('IPv4' !== iface.family || iface.internal !== false) {
                return;
            }
            localIp = iface.address;
        });
    });

    return localIp;
};`