Awesome
clnrest-rs
A rust rewrite of clnrest
Installation
There is two ways you can do this, either edit the config or switch out the plugin file:
CLN v24.05 and later
- Either replace
/usr/local/libexec/c-lightning/plugins/clnrest/clnrest
(can be different path depending on your OS) with the binary from this repo - Or edit the config:
disable-plugin=clnrest
plugin=/path/to/clnrest-rs
CLN v24.02.2 and older
- Either replace
/usr/local/libexec/c-lightning/plugins/clnrest/clnrest.py
(can be different path depending on your OS) with the binary from this repo. - Or edit the config:
disable-plugin=clnrest.py
plugin=/path/to/clnrest-rs
Release binaries for
- x86_64-linux
- armv7-linux (Raspberry Pi 32bit)
- aarch64-linux (Raspberry Pi 64bit)
can be found on the release page. If you are unsure about your architecture you can run uname -m
.
They require glibc>=2.31
, which you can check with ldd --version
.
Building
You can build the plugin yourself instead of using the release binaries. First clone the repo:
git clone https://github.com/daywalker90/clnrest-rs.git
Install a recent rust version (rustup is recommended) and in the clnrest-rs
folder run:
cargo build --release
After that the binary will be here: target/release/clnrest-rs
Note: Release binaries are built using cross
and the optimized
profile.
Options
These work the same as with the python implementation:
Required options
clnrest-port
: REST server port to listen on
Optional options
clnrest-certs
: Path for certificates (for https), if you have your own certificates, otherwise clnrest will generate self-signed certs in yourlightning-dir
clnrest-protocol
: REST server protocol (https
orhttp
), defaults tohttps
clnrest-host
: REST server host, defaults to127.0.0.1
clnrest-cors-origins
:Cross origin resource sharing origins, defaults to*
clnrest-csp
: Content security policy (CSP) for the server, defaults todefault-src 'self'; font-src 'self'; img-src 'self' data:; frame-src 'self'; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline';
clnrest-swagger-root
: Root path for Swagger UI, defaults to/
Thanks
Thank you to the original author of clnrest Shahana