sensei icon indicating copy to clipboard operation
sensei copied to clipboard

CLI Host, port, and token can be set at runtime

Open litch opened this issue 2 years ago • 4 comments

Ok, this is my re-attempt at making the CLI work again

% cargo run --bin senseicli -- --node 0090a039-f1dd-4daa-a7e1-1446f9c9bbae --token 8d55f4eaba224b78788c866
a3be09f8c7dc0c2def0a57e9a55e658ac95689b17 nodeinfo

InfoResponse { node_info: Some(Info { node_pubkey: "02ccd784d90a263c60c50b248d0234e4ecf52a221438b2c525765072af4fb20de5", num_channels: 1, num_usable_channels: 1, num_peers: 1 }) }

It feels pretty verbose to put all that on the CLI, but this actually gets the CLI back to a working state. I'm seeing unrelated errors it looks with listchannels returning an empty set, but the other node can see my channel, and the nodeinfo command shows an active channel (as above). But this gets it to working

litch avatar Apr 25 '22 12:04 litch

Getting closer! You shouldn't need (or require) the admin access token for accessing the individual node apis as those are completely authenticated by the macaroon.

Happy to merge this since it's completely broken in main at the moment but I still think the better path forward is to probably write out the 'admin access token' to filesystem in DATA_DIR/NEWORK/access.token or some fixed path based on data directory and network.

It can try to read it from that path if it's not provided as a cli arg.

Once the database work I'm doing lands I don't think there will even be these node directories anymore since there'll be a single database for all the nodes. Will probably make this simpler so maybe we don't take the cli too far until that lands.

johncantrell97 avatar Apr 25 '22 14:04 johncantrell97

Yes! I was looking at segmenting off the AdminClient api calls (init, start, create_node, list_nodes, to “want” separate data).

litch avatar Apr 25 '22 14:04 litch

Ok, I've done a bit of restructuring, and thinking, and going to do a bit more restructuring -

[ ] - The ListNodes command should list the nodes [ ] - Admin token is written to the caller filesystem

litch avatar Apr 27 '22 13:04 litch

This turned into a bit of a mess. Sorry. I may re-do it once I have a better feel for what I'm actually trying to accomplish. I've discovered several error states I could put my system into, and trying to help them recover. Trying to add some instrumentation and such to help with debugging. Not sure that it's all totally appropriate in a "repair the CLI" bit of work, and almost certainly not worth doing if I'm just trying to get a few methods looking better. So probably worth making a decision about "smallest mergable/usable" piece of work and go from there.

litch avatar Apr 30 '22 23:04 litch