-
Notifications
You must be signed in to change notification settings - Fork 4
made port and bind configurable #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
ctx) | ||
|
||
(def before-steps [find-free-nrepl-port | ||
(def before-steps [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like an extra newline?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, some emacs automation. I can remove it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. I think @plexus should review this change because I'm not sure what API he has in mind for the project as a whole—I don't want to approve this if he had other plans for -b
and -p
, for example.
Also, just to be clear to other reviewers, picking a port at random and choosing 127.0.0.1
were the existing behavior.
(assoc ctx :nrepl-port (or (get-in ctx [:options :nrepl-port]) | ||
(free-port)))) | ||
|
||
(defn get-nrepl-bind [ctx] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me know if this isn't technically correct, but I think of binding as applying to a port and address. I would use adddress
instead of bind
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not 100 % sure on this.
nrepl.cmd has three options related to "networking"
-b/--bind ADDR Bind address, by default "127.0.0.1".
-h/--host ADDR Host address to connect to when using --connect. Defaults to "127.0.0.1".
-p/--port PORT Start nREPL on PORT. Defaults to 0 (random port) if not specified.
I think "host" is something different... Only used when using the nrepl.cmd to connect to an other repl.
We could as well allow it to be configured as part of the "launchpad"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's following nREPL, then I think bind makes sense.
I want to add as well that nrepl itself can be configured via a "nrepl.edn" file, see here: This does not work current for launchpad, because it "overwrites" the port. So maybe this is an other way to solve the issue. |
all three solutions are fine for my usecase (run launchpad from Docker):
|
I am now even thinking that option 3 is the best one. |
@behrica I like option 3, although being able to configure it both in |
Thanks @behrica, this looks good as a first step. I have a generic mechanism in mind for setting options in As for removing the find-port handling, we need to know which port was picked later on, that's why launchpad determines the port itself. I'm not sure yet if we want to handle |
Released in [com.lambdaisland/launchpad "0.15.79-alpha"]
{com.lambdaisland/launchpad {:mvn/version "0.15.79-alpha"}} |
This solves #8
my use case is to run launchpad from inside Docker.
This requires to set bind to "0.0.0.0" and have a stable port, so I can specify the port to expose while starting Docker.