-
Notifications
You must be signed in to change notification settings - Fork 7
Update appy.js #1
base: master
Are you sure you want to change the base?
Conversation
Even though there is code in place to make the port selection of the application highly configurable, there needs to be a way to define the host to which the process binds to, in the same configurable manner. For example when exposing to port :80 via nginx you don't want the site to be available on :3000 as well. This could be solved with a firewall rule, but then this may not be available to the developer deploying the application.
|
I appreciate where you're going with this, but you have a lot of '==' where I would expect '===' and I'm not sure why you're doing that. '0.0.0.0' might actually == 'undefined'... can you clarify the intent or clean up that code? |
|
Hello Tom, The logic is 3 fold.
I am setting 0.0.0.0 on the assumption that a user would expect to deploy the application and view in their browser in their staging or production server on the port they specified regardless of the server hostname. By setting 0.0.0.0 as the default host you bypass the /etc/hosts file and bind to all addresses on the system You are right about the == vs the === which I can correct. Does the above make sense? |
|
Yep, it all makes sense except for the ==. On Tue, Jun 18, 2013 at 9:31 AM, Fotis Paraskevopoulos <
Tom Boutell |
Corrected == vs ===
|
Hello Tom, I corrected the ==, please let me know if you require any other code formatting or modifications. |
|
Thanks Fotis, this is a lot closer. This line is still weird: if(host !==undefined || host !==''){ If it's undefined, it's not '', and if it's '', it's not undefined. So this On Wed, Jun 19, 2013 at 3:36 AM, Fotis Paraskevopoulos <
Tom Boutell |
|
I think you probably want: if (host !== undefined) Straight up. On Wed, Jun 19, 2013 at 11:19 AM, Tom Boutell [email protected] wrote:
Tom Boutell |
Correcting logic when an empty host is given as a parameter
|
Hello Tom, Doing host !== undefined would suffice, but I just corrected the logic so that when a user calls appy.listen('') that will default to 0.0.0.0 If you think it is superfluous it can be removed. Best, |
|
The problem with reading port and host from file is I think variables cannot be used. Is this the case? E.g. for Openshift's process.env.OPENSHIFT_NODEJS_PORT and process.env.OPENSHIFT_NODEJS_IP. Please advise. |
|
ADDRESS and PORT environment variables are supported and have been for some On Sun, Apr 5, 2015 at 4:20 AM, Jeremiah Harlan [email protected]
*THOMAS BOUTELL, *DEV & OPS |
|
... After that we'd need a bridge for specifying the host and port in On Mon, Apr 6, 2015 at 9:09 AM, Tom Boutell [email protected] wrote:
*THOMAS BOUTELL, *DEV & OPS |
Even though there is code in place to make the port selection of the application highly configurable, there needs to be a way to define the host to which the process binds to, in the same configurable manner.
For example when exposing to port :80 via nginx you don't want the site to be available on :3000 as well. This could be solved with a firewall rule, but then this may not be available to the developer deploying the application.