From 413aad5efa70775d8d4d95e6f4ebbf49dcbb0bf6 Mon Sep 17 00:00:00 2001 From: "Johan T. Halseth" Date: Thu, 13 Dec 2018 12:26:30 +0100 Subject: [PATCH] lnrpc+subserver_cfg: add configs for autopilot sub-server --- lnrpc/autopilotrpc/config_active.go | 17 +++++++++++++++++ lnrpc/autopilotrpc/config_default.go | 6 ++++++ subrpcserver_config.go | 5 +++++ 3 files changed, 28 insertions(+) create mode 100644 lnrpc/autopilotrpc/config_active.go create mode 100644 lnrpc/autopilotrpc/config_default.go diff --git a/lnrpc/autopilotrpc/config_active.go b/lnrpc/autopilotrpc/config_active.go new file mode 100644 index 00000000..93aca4f2 --- /dev/null +++ b/lnrpc/autopilotrpc/config_active.go @@ -0,0 +1,17 @@ +// +build autopilotrpc + +package autopilotrpc + +import ( + "github.com/lightningnetwork/lnd/autopilot" +) + +// Config is the primary configuration struct for the autopilot RPC server. It +// contains all the items required for the rpc server to carry out its +// duties. The fields with struct tags are meant to be parsed as normal +// configuration options, while if able to be populated, the latter fields MUST +// also be specified. +type Config struct { + // Manager is the running autopilot manager. + Manager *autopilot.Manager +} diff --git a/lnrpc/autopilotrpc/config_default.go b/lnrpc/autopilotrpc/config_default.go new file mode 100644 index 00000000..2d42ab51 --- /dev/null +++ b/lnrpc/autopilotrpc/config_default.go @@ -0,0 +1,6 @@ +// +build !autopilotrpc + +package autopilotrpc + +// Config is empty for non-autopilotrpc builds. +type Config struct{} diff --git a/subrpcserver_config.go b/subrpcserver_config.go index b63cf95c..de4c3b6e 100644 --- a/subrpcserver_config.go +++ b/subrpcserver_config.go @@ -4,6 +4,7 @@ import ( "fmt" "reflect" + "github.com/lightningnetwork/lnd/lnrpc/autopilotrpc" "github.com/lightningnetwork/lnd/lnrpc/signrpc" "github.com/lightningnetwork/lnd/lnrpc/walletrpc" "github.com/lightningnetwork/lnd/macaroons" @@ -25,6 +26,10 @@ type subRPCServerConfigs struct { // also requests keys and addresses under control of the backing // wallet. WalletKitRPC *walletrpc.Config `group:"walletrpc" namespace:"walletrpc"` + + // AutopilotRPC is a sub-RPC server that exposes methods on the running + // autopilot as a gRPC service. + AutopilotRPC *autopilotrpc.Config `group:"autopilotrpc" namespace:"autopilotrpc"` } // PopulateDependencies attempts to iterate through all the sub-server configs