cloudfoundry-community / node-cfenv

easy access to your Cloud Foundry application environment for node
Apache License 2.0
74 stars 20 forks source link

Default port on local without ports #17

Open mathieug opened 8 years ago

mathieug commented 8 years ago

We should be able to set a default port if we don't want to use ports package. Why not in options of cfenv.getAppEnv(options)?

pmuellr commented 7 years ago

Seems like, in theory, you could do this by having an options object with the following shape, since the port is also specified in VCAP_APPLICATION:

{
  vcap: {
    application: {
      port: myPortNumber
    }
  }
}

Doesn't look like this would work today, as only env vars are checked, but ... the code could be changed to check that also.

Advantage of doing it that way is there are fewer options to set the port, which should make it easier to figure out what port to actually use. Disadvantage is that it's a bit of a mouthful to use - an explicit port value in options would be less wordy.

pmuellr commented 7 years ago

Is there still any interest in doing something here?