plugins/clnrest: disable ourselves unless rest-port is set.

This mirrors grpc's behavior, and avoids listening on ports without
explicit user permission.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2023-07-15 14:13:01 +09:30
parent abcfda133f
commit 2ab0b4af3e
4 changed files with 13 additions and 3 deletions

View File

@@ -6,11 +6,14 @@ CERTS_PATH, REST_PROTOCOL, REST_HOST, REST_PORT = "", "", "", ""
def set_config(options):
if 'rest-port' not in options:
return "`rest-port` option is not configured"
global CERTS_PATH, REST_PROTOCOL, REST_HOST, REST_PORT
CERTS_PATH = str(options["rest-certs"])
REST_PROTOCOL = str(options["rest-protocol"])
REST_HOST = str(options["rest-host"])
REST_PORT = int(options["rest-port"])
return None
def call_rpc_method(plugin, rpc_method, payload):