mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
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.
This commit is contained in:
committed by
ZmnSCPxj, ZmnSCPxj jxPCSmnZ
parent
689dd28ddd
commit
4f3e8d461e
@@ -9,6 +9,7 @@
|
|||||||
#include <ccan/opt/opt.h>
|
#include <ccan/opt/opt.h>
|
||||||
#include <ccan/read_write_all/read_write_all.h>
|
#include <ccan/read_write_all/read_write_all.h>
|
||||||
#include <ccan/str/str.h>
|
#include <ccan/str/str.h>
|
||||||
|
#include <ccan/tal/path/path.h>
|
||||||
#include <ccan/tal/str/str.h>
|
#include <ccan/tal/str/str.h>
|
||||||
#include <common/configdir.h>
|
#include <common/configdir.h>
|
||||||
#include <common/json.h>
|
#include <common/json.h>
|
||||||
@@ -492,6 +493,13 @@ int main(int argc, char *argv[])
|
|||||||
tal_free(page);
|
tal_free(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If an absolute path to the RPC socket is given, it takes over other
|
||||||
|
* configuration options. */
|
||||||
|
if (path_is_abs(rpc_filename)) {
|
||||||
|
net_dir = path_dirname(ctx, rpc_filename);
|
||||||
|
rpc_filename = path_basename(ctx, rpc_filename);
|
||||||
|
}
|
||||||
|
|
||||||
if (chdir(net_dir) != 0)
|
if (chdir(net_dir) != 0)
|
||||||
err(ERROR_TALKING_TO_LIGHTNINGD, "Moving into '%s'",
|
err(ERROR_TALKING_TO_LIGHTNINGD, "Moving into '%s'",
|
||||||
net_dir);
|
net_dir);
|
||||||
|
|||||||
Reference in New Issue
Block a user