storj-archived / core

Deprecated. Implementation of the Storj v2 protocol for Node.js.
https://storj.io
Other
395 stars 88 forks source link

Add an optional different listenPort for local rpc to bind to #696

Closed felixbrucker closed 7 years ago

felixbrucker commented 7 years ago

Allow the use of an optional different listening port to be supplied for the rpc server to bind to.

This is useful when starting storjshare with the rpcPort: 80 and listenPort: 10001 and a nginx reverse proxy configured to proxy from 80 -> 10001. In such a case storjshare can still run as non-root and one is able to neatly manage all dns and address configuration via nginx.

coveralls commented 7 years ago

Coverage Status

Coverage decreased (-0.06%) to 99.94% when pulling 9a64196e4466136418135fc17963fb653b1ceda8 on felixbrucker:feature/listen-port into 3a5a94e9ee6e2f4b61eac70437bc4bbb76809202 on Storj:master.

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling baaa4f4853c147038157a66ce287abca17f6e7e6 on felixbrucker:feature/listen-port into 3a5a94e9ee6e2f4b61eac70437bc4bbb76809202 on Storj:master.

tacticalchihuahua commented 7 years ago

FYI this is already available in the core7 tree:

const node = new storj.Node({
  // ...
  contact: {
    // ...
    port: 80
  }
});

node.listen(10001);

That said, will happily merge this to add the capability now. Can you include a unit test in for the Transport class that asserts that listenPort is used is supplied?

felixbrucker commented 7 years ago

i'll play around and try :)

Edit: seems to work!

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling e7ccdb2230fb44debebfa59318e2db1ee1ec4588 on felixbrucker:feature/listen-port into 3a5a94e9ee6e2f4b61eac70437bc4bbb76809202 on Storj:master.