Fork me on GitHub
#babashka
<
2022-11-14
>
kipz22:11:54

Hey. Thanks for babashka. It gets better each time I pick it up! I'm running it as a long running process with an http-kit server, and would like it to serve up an nrepl server based on a CLI switch. Is this possible? I've tried to do the same calls that bb nrepl-server does, but those namespaces don't seem to be available at runtime. Any advice?

borkdude22:11:52

@kipz There is a babashka.nrepl.server namespace available with start-server! and stop-server!

borkdude22:11:32

$ bb -e "(babashka.nrepl.server/start-server\!) (deref (promise))"
Started nREPL server at 0.0.0.0:1667

kipz22:11:25

Amazing. Thanks. I was looking at https://github.com/babashka/babashka.nrepl/blob/master/src/babashka/nrepl/server.clj and didn't know how to create a context that worked, but we don't need one!

kipz22:11:56

So this is already partially applied and altered with an appropriate context or something I guess

borkdude22:11:06

We should document this somewhere, probably http://book.babashka.org - PR welcome. Yes, the ctx is partially applied

kipz22:11:42

Got it, thanks. I went down a rabbit hole trying to create a context for myself 🤯

kipz22:11:14

I'll try to doc it. Thanks again.

kipz22:11:51

done.

👍 1
staypufd18:11:36

@U04V15CAJ What do you all mean here in “partially applied”?

borkdude18:11:02

The context is implicitly used in the exposed API, it's not an explicit argument

staypufd18:11:11

OK - So the start and stop server functions with no args calling the 1 arity function which itself uses @common/ctx

staypufd18:11:16

Thanks for explination