Closed openoms closed 3 years ago
I run lightningd
through systemd
and my path to the socket is in the runtime directory /run/lightningd/lightning-rpc
Not being able to specify that in either the lightning.conf
with a rest-rpc-path=PATH
or in cl-rest-config.json
with RPCPATH
makes it very difficult to get the REST endpoint up and running.
Current working workaround is to use systemd
as the lightning-rpc
socket is created at runtime and the plugin will not connect.
lightning-rest.service
[Service]
Environment="LN_PATH=/run/lightningd/"
ExecStart=/usr/bin/node /opt/c-lightning-REST/cl-rest.js
Where LN_PATH
is used in ./app.js
and
to modify ./lightning-client-js.js
const JSONParser = require('jsonparse')
const LightningError = require('error/typed')({ type: 'lightning', message: 'lightning-client error' })
const methods = require('./methods');
//const defaultRpcPath = path.join(require('os').homedir(), '.lightning')
const defaultRpcPath = path.join('/run', 'lightningd')
, fStat = (...p) => fs.statSync(path.join(...p))
, fExists = (...p) => fs.existsSync(path.join(...p))
@openoms and @crabel99
Configuration for lightning-rpc
location was already configurable via an environment variable LN_PATH
.
With the linked PR, we are making it easier to configure by adding an additional config parameter LNRPCPATH
.
Merged to the release branch for v0.5.0
Currently it is assumed that c-lightning-REST is run by the same user as the lightningd.
For the user
bitcoin
it looks for thelightning-rpc
in/home/bitcoin/.lightning/lightning-rpc
which is normally non-existent.In case lightning is run with multiple networks on the node can symlink to
/home/bitcoin/.lightning/lightning-rpc
from the chosen network directory e.g:sudo ln -s /home/bitcoin/.lightning/signet/lightning-rpc /home/bitcoin/.lightning/
To be able to specify the
.lightning
directory path (and within thelightning-rpc
) would be make it possible to run multiple c-lightning-REST servers parallel for the different networks.