Skip to content

Commit 4f3e8d4

Browse files
darosiorZmnSCPxj
authored andcommitted
cli: make '--rpc-file' take over other config options if absolute
If absolute, we can deduce the lightning_dir, the network, and the socket filename out of it. This allows to be able to only specify the 'rpc-file', as before. Changelog-Changed: Usage of `lightning-cli` by specifying only `--rpc-file` has been restored.
1 parent 689dd28 commit 4f3e8d4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

cli/lightning-cli.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <ccan/opt/opt.h>
1010
#include <ccan/read_write_all/read_write_all.h>
1111
#include <ccan/str/str.h>
12+
#include <ccan/tal/path/path.h>
1213
#include <ccan/tal/str/str.h>
1314
#include <common/configdir.h>
1415
#include <common/json.h>
@@ -492,6 +493,13 @@ int main(int argc, char *argv[])
492493
tal_free(page);
493494
}
494495

496+
/* If an absolute path to the RPC socket is given, it takes over other
497+
* configuration options. */
498+
if (path_is_abs(rpc_filename)) {
499+
net_dir = path_dirname(ctx, rpc_filename);
500+
rpc_filename = path_basename(ctx, rpc_filename);
501+
}
502+
495503
if (chdir(net_dir) != 0)
496504
err(ERROR_TALKING_TO_LIGHTNINGD, "Moving into '%s'",
497505
net_dir);

0 commit comments

Comments
 (0)