Skip to content

Commit ce51c6f

Browse files
committed
Forward a :bind option for starting a repl as well
1 parent 55f94d0 commit ce51c6f

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

README.md

+10-8
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,16 @@ The following options affect the behavior of the web server started by
111111
If true, automatically refresh the browser when source or resource
112112
files are modified. Defaults to false.
113113

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

123125
## Executable jar files
124126

src/leiningen/ring/server.clj

+4-1
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,13 @@
5252
~@(map #(if (symbol? %) (list 'var %) %) middleware)))
5353

5454
(defn start-nrepl-expr [project]
55-
(let [port (-> project :ring :nrepl (:port 0))
55+
(let [nrepl-opts (-> project :ring :nrepl)
56+
port (:port nrepl-opts 0)
57+
bind (:bind nrepl-opts)
5658
handler (nrepl-handler (nrepl-middleware project))]
5759
`(let [{port# :port} (clojure.tools.nrepl.server/start-server
5860
:port ~port
61+
:bind ~bind
5962
:handler ~handler)]
6063
(doseq [port-file# ["target/repl-port" ".nrepl-port"]]
6164
(-> port-file#

0 commit comments

Comments
 (0)