Skip to content

Commit 23ef15c

Browse files
committed
reckless: Added test plugin with required options (added to canned server too)
1 parent 029ae2a commit 23ef15c

3 files changed

Lines changed: 70 additions & 0 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pyln-client
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env python3
2+
"""Plugin that requires a mandatory option. Exits immediately when the
3+
option is absent - as happens when reckless runs the plugin standalone
4+
outside of a CLN connection."""
5+
import os
6+
import sys
7+
8+
if not os.environ.get('TESTPLUG_REQUIRED_OPT'):
9+
print("required option 'required-opt' is not configured", file=sys.stderr)
10+
sys.exit(1)
11+
12+
from pyln.client import Plugin
13+
14+
plugin = Plugin()
15+
16+
17+
@plugin.init()
18+
def init(options, configuration, plugin, **kwargs):
19+
plugin.log("testplugreqopts initialized")
20+
21+
22+
plugin.run()
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
[
2+
{
3+
"name": "testplugpass",
4+
"path": "testplugpass",
5+
"url": "https://api.github.com/repos/lightningd/plugins/contents/webhook?ref=master",
6+
"html_url": "https://github.com/lightningd/plugins/tree/master/testplugpass",
7+
"git_url": "https://api.github.com/repos/lightningd/plugins/git/trees/testplugpass",
8+
"download_url": null,
9+
"type": "dir"
10+
},
11+
{
12+
"name": "testpluguv",
13+
"path": "testpluguv",
14+
"url": "https://api.github.com/repos/lightningd/plugins/contents/webhook?ref=master",
15+
"html_url": "https://github.com/lightningd/plugins/tree/master/testpluguv",
16+
"git_url": "https://api.github.com/repos/lightningd/plugins/git/trees/testpluguv",
17+
"download_url": null,
18+
"type": "dir"
19+
},
20+
{
21+
"name": "testplugfail",
22+
"path": "testplugfail",
23+
"url": "https://api.github.com/repos/lightningd/plugins/contents/testplugfail?ref=master",
24+
"html_url": "https://github.com/lightningd/plugins/tree/master/testplugfail",
25+
"git_url": "https://api.github.com/repos/lightningd/plugins/git/trees/testplugfail",
26+
"download_url": null,
27+
"type": "dir"
28+
},
29+
{
30+
"name": "testplugpyproj",
31+
"path": "testplugpyproj",
32+
"url": "https://api.github.com/repos/lightningd/plugins/contents/webhook?ref=master",
33+
"html_url": "https://github.com/lightningd/plugins/tree/master/testplugpyproj",
34+
"git_url": "https://api.github.com/repos/lightningd/plugins/git/trees/testplugpyproj",
35+
"download_url": null,
36+
"type": "dir"
37+
},
38+
{
39+
"name": "testplugreqopts",
40+
"path": "testplugreqopts",
41+
"url": "https://api.github.com/repos/lightningd/plugins/contents/testplugreqopts?ref=master",
42+
"html_url": "https://github.com/lightningd/plugins/tree/master/testplugreqopts",
43+
"git_url": "https://api.github.com/repos/lightningd/plugins/git/trees/testplugreqopts",
44+
"download_url": null,
45+
"type": "dir"
46+
}
47+
]

0 commit comments

Comments
 (0)