Fork me on GitHub
#babashka
<
2024-02-09
>
vxe06:02:08

I am really enjoying bb + clomacs via this repo earlier in thread: https://github.com/davidpham87/prelude/tree/master/personal/clomacs . Wanted to check if feasible to modify this to get to work with nbb? thanks in advance

borkdude07:02:45

Is this a message for the maintainer of clomacs?

vxe07:02:13

I guess yeah or other users if any of this workflow: https://clojurians.slack.com/archives/CLX41ASCS/p1635238134027600

borkdude07:02:15

Maybe ping David here then

David Pham07:02:21

I am not the maintainer of clomacs haha. I guess, does nbb provide an NREPL as well?

👀 1
David Pham07:02:24

Well, it should be feasible then. As clomacs use cider to communicate with bb

vxe07:02:41

yeah seems same:

% nbb --help | grep nrepl
 nrepl-server: start nrepl server. [1,2]

% bb --help | grep nrepl
  nrepl-server [addr]  Start nREPL server. Address defaults to localhost:1667.
i’ll try at some point, s/bb/nbb and see what happens

David Pham07:02:18

Otherwise you could pipe the result and the call to nbb using bb as intermediary :rolling_on_the_floor_laughing:

😂 1
vxe08:02:08

seems like nbb doesn’t take a -f as bb does to bootstrap from cloamcs’ init.clj , I assume this is unlikely to change, correct @U04V15CAJ?

% bb --help | grep '\-f'
  -f, --file  Run file
  print-deps [--format ]: prints a deps.edn map or classpath

% nbb --help | grep '\-f'

borkdude09:02:17

@U5Y86G3KL not sure what you mean by this

borkdude09:02:36

can you link me to the relevant code?

👀 1
vxe11:02:37

https://github.com/davidpham87/prelude/tree/master/personal/clomacs#clomacs also looks like need to translate all the java bits here to node equivalent, prob a little more work than I’m able to do atm 😅

(cl-defun bbmacs-bb-process
    (&optional (dir bbmacs-clomacs-dir) (port bbmacs-port))
  (let ((default-directory dir)
        (port (number-to-string port)))
    (make-process
     :name "bbmacs-nrepl"
     :buffer (concat "*bbmacs-nrepl" port "*")
     :command `("bb" "-f" "init.clj" ,port))))

borkdude11:02:27

you can programmatically start an nrepl server from bb and nbb, there is no need to shell out like that (anymore)

borkdude11:02:45

anyway I'd take it up with the clomacs project probably. if they have any questions about bb or nbb, let me know

borkdude11:02:50

#C04QLT4HQPK

vxe11:02:57

will do, thx

jmglov10:02:18

🎉 1
👍 1
eval202012:02:52

I encountered that babashka/http-client passes the Authorization-header on when following a (cross origin) redirect. Specific case was GET-ing an artifact via the github-api that redirected to host *. which responded with a 4XX because of the Authorization-header. Doing a HEAD, extract the Location and do a separate non-auth request worked. Searching a bit but can’t find anything that might instruct http://java.net.http.HttpClient to do it differently.

borkdude12:02:29

I'm not sure if #C04J0N76E2G does anything special regarding this, might just be underlying behavior.

borkdude12:02:37

Feel free to take a look in the source though

borkdude12:02:54

If all else fails, you could try to not redirect and do the redirect yourself

eval202012:02:08

> I’m not sure if #C04J0N76E2G does anything special regarding this, might just be underlying behavior. (Sorry, missed the separate channel). I’m afraid it is indeed baked in.

eval202012:02:39

FWIW https://github.com/dotnet/runtime/issues/26475#issuecomment-432878482 where they mention removing these headers on redirect as security fix in 2018.