mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-21 08:04:26 +01:00
plugin: Have the helloworld plugin accept a configure message
Just customizes the greeting, the actual sending is in the next commit. Signed-off-by: Christian Decker <@cdecker>
This commit is contained in:
@@ -11,17 +11,21 @@ import json
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
greeting = "World"
|
||||||
|
|
||||||
|
|
||||||
def json_hello(request):
|
def json_hello(request):
|
||||||
greeting = "Hello {}".format(request['params']['name'])
|
greeting = "Hello {}".format(request['params']['name'])
|
||||||
return greeting
|
return greeting
|
||||||
|
|
||||||
|
|
||||||
def json_init(request):
|
def json_init(request):
|
||||||
|
global greeting
|
||||||
return {
|
return {
|
||||||
"options": [
|
"options": [
|
||||||
{"name": "greeting",
|
{"name": "greeting",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"default": "World",
|
"default": greeting,
|
||||||
"description": "What name should I call you?"},
|
"description": "What name should I call you?"},
|
||||||
],
|
],
|
||||||
"rpcmethods": [
|
"rpcmethods": [
|
||||||
@@ -36,7 +40,10 @@ def json_init(request):
|
|||||||
def json_configure(request):
|
def json_configure(request):
|
||||||
"""The main daemon is telling us the relevant cli options
|
"""The main daemon is telling us the relevant cli options
|
||||||
"""
|
"""
|
||||||
return None
|
global greeting
|
||||||
|
|
||||||
|
greeting = request['params']['options']['greeting']
|
||||||
|
return "ok"
|
||||||
|
|
||||||
|
|
||||||
def json_ping(request):
|
def json_ping(request):
|
||||||
@@ -47,6 +54,7 @@ methods = {
|
|||||||
'hello': json_hello,
|
'hello': json_hello,
|
||||||
'init': json_init,
|
'init': json_init,
|
||||||
'ping': json_ping,
|
'ping': json_ping,
|
||||||
|
'configure': json_configure,
|
||||||
}
|
}
|
||||||
|
|
||||||
partial = ""
|
partial = ""
|
||||||
|
|||||||
Reference in New Issue
Block a user