weavejester / ring-server

51 stars 24 forks source link

Port number option precedence? #18

Open radhikalism opened 10 years ago

radhikalism commented 10 years ago

Hi James,

The readme for lein-ring suggests this of $PORT: "These will override any options specified in the project.clj file, but won't override any options specified at the command line."

This appears to rely on the mechanism from ring-server, in options.clj:

  (or (:port options)
      (-?> (*env* "PORT") Integer.)
      (range 3000 3010))

which gives precedence to :adapter :port defined in project.clj, not the env var. This appears to affect both lein ring server and standalone builds.

Am I reading this correctly?

On a related note, do you have any thoughts on using your environ library to receive these options? I find it creates a pleasant interface for option overriding -- just flexible enough and appropriately unsurprising.

Thanks