Navigation Menu

Skip to content

Commit

Permalink
Merge pull request #161 from gfredericks/nrepl-bind
Browse files Browse the repository at this point in the history
Forward a :bind option for starting a repl as well
  • Loading branch information
MichaelBlume committed May 14, 2015
2 parents 55f94d0 + ce51c6f commit 3941915
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
18 changes: 10 additions & 8 deletions README.md
Expand Up @@ -111,14 +111,16 @@ The following options affect the behavior of the web server started by
If true, automatically refresh the browser when source or resource
files are modified. Defaults to false.

* `:nrepl` -
A map of `:start?` and (optionally) `:port` keys. If `:start?` is true,
open up an nREPL server on the given port. `:start?` defaults to false,
`:port` defaults to an arbitrary free port. __NOTE: This option is only
for development with the `lein ring server` task. Setting this option
will not cause a generated uberjar/uberwar to run an nREPL server. If
you would like to run an nREPL server in your production app, then see
the clojure.tools.nrepl.server project.__
* `:nrepl` -
A map of `:start?` and (optionally) `:port` and `:bind` keys. If
`:start?` is true, open up an nREPL server on the given
port. `:start?` defaults to false, `:port` defaults to an arbitrary
free port, and `:bind` defaults to `"localhost"`. __NOTE: This
option is only for development with the `lein ring server` task.
Setting this option will not cause a generated uberjar/uberwar to
run an nREPL server. If you would like to run an nREPL server in
your production app, then see the clojure.tools.nrepl.server
project.__

## Executable jar files

Expand Down
5 changes: 4 additions & 1 deletion src/leiningen/ring/server.clj
Expand Up @@ -52,10 +52,13 @@
~@(map #(if (symbol? %) (list 'var %) %) middleware)))

(defn start-nrepl-expr [project]
(let [port (-> project :ring :nrepl (:port 0))
(let [nrepl-opts (-> project :ring :nrepl)
port (:port nrepl-opts 0)
bind (:bind nrepl-opts)
handler (nrepl-handler (nrepl-middleware project))]
`(let [{port# :port} (clojure.tools.nrepl.server/start-server
:port ~port
:bind ~bind
:handler ~handler)]
(doseq [port-file# ["target/repl-port" ".nrepl-port"]]
(-> port-file#
Expand Down

0 comments on commit 3941915

Please sign in to comment.