File tree Expand file tree Collapse file tree 1 file changed +60
-0
lines changed Expand file tree Collapse file tree 1 file changed +60
-0
lines changed Original file line number Diff line number Diff line change 1+ //go:build dev
2+ // +build dev
3+
4+ package main
5+
6+ import (
7+ "context"
8+
9+ "github.com/lightninglabs/loop/looprpc"
10+ "github.com/urfave/cli"
11+ )
12+
13+ func init () {
14+ // Register the debug command.
15+ commands = append (commands , forceAutoloopCmd )
16+ }
17+
18+ var forceAutoloopCmd = cli.Command {
19+ Name : "forceautoloop" ,
20+ Usage : `` `
21+ Forces to trigger an autoloop step, regardless of the current internal
22+ autoloop timer. THIS MUST NOT BE USED IN A PROD ENVIRONMENT.
23+ ` `` ,
24+ Action : forceAutoloop ,
25+ }
26+
27+ func forceAutoloop (ctx * cli.Context ) error {
28+ client , cleanup , err := getDebugClient (ctx )
29+ if err != nil {
30+ return err
31+ }
32+ defer cleanup ()
33+
34+ cfg , err := client.ForceAutoLoop (
35+ context.Background ( ), & looprpc .ForceAutoLoopRequest {},
36+ )
37+ if err != nil {
38+ return err
39+ }
40+
41+ printRespJSON (cfg )
42+
43+ return nil
44+ }
45+
46+ func getDebugClient (ctx * cli.Context ) (looprpc.DebugClient , func (), error ) {
47+ rpcServer := ctx .GlobalString ("rpcserver" )
48+ tlsCertPath , macaroonPath , err := extractPathArgs (ctx )
49+ if err != nil {
50+ return nil , nil , err
51+ }
52+ conn , err := getClientConn (rpcServer , tlsCertPath , macaroonPath )
53+ if err != nil {
54+ return nil , nil , err
55+ }
56+ cleanup := func () { conn .Close () }
57+
58+ debugClient := looprpc .NewDebugClient (conn )
59+ return debugClient , cleanup , nil
60+ }
You can’t perform that action at this time.
0 commit comments