Skip to content
This repository was archived by the owner on Aug 4, 2025. It is now read-only.

Conversation

@fotisp
Copy link

@fotisp fotisp commented Jun 18, 2013

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.

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.
@boutell
Copy link

boutell commented Jun 18, 2013

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?

@fotisp
Copy link
Author

fotisp commented Jun 18, 2013

Hello Tom,

The logic is 3 fold.

  1. There is a default host value "setHost" which binds to all addresses
  2. Then there is the data/host file where you can modify your hosts file
  3. There is the hard-coded host passed in as a variable.

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?

@boutell
Copy link

boutell commented Jun 18, 2013

Yep, it all makes sense except for the ==.

On Tue, Jun 18, 2013 at 9:31 AM, Fotis Paraskevopoulos <
[email protected]> wrote:

Hello Tom,

The logic is 3 fold.

  1. There is a default host value "setHost" which binds to all addresses
  2. Then there is the data/host file where you can modify your hosts file
  3. There is the hard-coded host passed in as a variable.

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?


Reply to this email directly or view it on GitHubhttps://github.com//pull/1#issuecomment-19611061
.

Tom Boutell
P'unk Avenue
215 755 1330
punkave.com
window.punkave.com

Corrected == vs ===
@fotisp
Copy link
Author

fotisp commented Jun 19, 2013

Hello Tom,

I corrected the ==, please let me know if you require any other code formatting or modifications.

@boutell
Copy link

boutell commented Jun 19, 2013

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
is always true.

On Wed, Jun 19, 2013 at 3:36 AM, Fotis Paraskevopoulos <
[email protected]> wrote:

Hello Tom,

I corrected the ==, please let me know if you require any other code
formatting or modifications.


Reply to this email directly or view it on GitHubhttps://github.com//pull/1#issuecomment-19667437
.

Tom Boutell
P'unk Avenue
215 755 1330
punkave.com
window.punkave.com

@boutell
Copy link

boutell commented Jun 19, 2013

I think you probably want:

if (host !== undefined)

Straight up.

On Wed, Jun 19, 2013 at 11:19 AM, Tom Boutell [email protected] wrote:

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 is always true.

On Wed, Jun 19, 2013 at 3:36 AM, Fotis Paraskevopoulos <
[email protected]> wrote:

Hello Tom,

I corrected the ==, please let me know if you require any other code
formatting or modifications.


Reply to this email directly or view it on GitHubhttps://github.com//pull/1#issuecomment-19667437
.

Tom Boutell
P'unk Avenue
215 755 1330
punkave.com
window.punkave.com

Tom Boutell
P'unk Avenue
215 755 1330
punkave.com
window.punkave.com

Correcting logic when an empty host is given as a parameter
@fotisp
Copy link
Author

fotisp commented Jun 19, 2013

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,
Fotis

@mannyvergel
Copy link

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.

@boutell
Copy link

boutell commented Apr 6, 2015

ADDRESS and PORT environment variables are supported and have been for some
time. But Jeremiah's pull request (#7) looks good if we can get the logic
for determining that a port was not specified right. I think it would be
sufficient to just use (!port). isNaN(port) doesn't really do what it
sounds like. (:

On Sun, Apr 5, 2015 at 4:20 AM, Jeremiah Harlan [email protected]
wrote:

I think it would be nice to be able to pass in the host and port. I don't
see why this would be a problem and it also helps devs worry about managing
two files (host and port).


Reply to this email directly or view it on GitHub
#1 (comment).

*THOMAS BOUTELL, *DEV & OPS
P'UNK AVENUE | (215) 755-1330 | punkave.com

@boutell
Copy link

boutell commented Apr 6, 2015

... After that we'd need a bridge for specifying the host and port in
Apostrophe as well via apostrophe-site but that's easy enough to do.

On Mon, Apr 6, 2015 at 9:09 AM, Tom Boutell [email protected] wrote:

ADDRESS and PORT environment variables are supported and have been for
some time. But Jeremiah's pull request (#7) looks good if we can get the
logic for determining that a port was not specified right. I think it would
be sufficient to just use (!port). isNaN(port) doesn't really do what it
sounds like. (:

On Sun, Apr 5, 2015 at 4:20 AM, Jeremiah Harlan [email protected]
wrote:

I think it would be nice to be able to pass in the host and port. I don't
see why this would be a problem and it also helps devs worry about managing
two files (host and port).


Reply to this email directly or view it on GitHub
#1 (comment).

*THOMAS BOUTELL, *DEV & OPS
P'UNK AVENUE | (215) 755-1330 | punkave.com

*THOMAS BOUTELL, *DEV & OPS
P'UNK AVENUE | (215) 755-1330 | punkave.com

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants