From dc0ab06d9119b97598595dcb9431904197500c69 Mon Sep 17 00:00:00 2001 From: Max Fang Date: Fri, 9 Jun 2017 18:19:14 -0700 Subject: [PATCH] config: Specify gRPC proxy port with --restport command line arg --- config.go | 3 +++ lnd.go | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/config.go b/config.go index 7584a473..b3930b01 100644 --- a/config.go +++ b/config.go @@ -26,6 +26,7 @@ const ( defaultLogDirname = "logs" defaultLogFilename = "lnd.log" defaultRPCPort = 10009 + defaultRESTPort = 8080 defaultPeerPort = 5656 defaultRPCHost = "localhost" defaultMaxPendingChannels = 1 @@ -87,6 +88,7 @@ type config struct { PeerPort int `long:"peerport" description:"The port to listen on for incoming p2p connections"` RPCPort int `long:"rpcport" description:"The port for the rpc server"` + RESTPort int `long:"restport" description:"The port for the REST server"` DebugHTLC bool `long:"debughtlc" description:"Activate the debug htlc mode. With the debug HTLC mode, all payments sent use a pre-determined R-Hash. Additionally, all HTLCs sent to a node with the debug HTLC R-Hash are immediately settled in the next available state transition."` MaxPendingChannels int `long:"maxpendingchannels" description:"The maximum number of incoming pending channels permitted per peer."` @@ -112,6 +114,7 @@ func loadConfig() (*config, error) { LogDir: defaultLogDir, PeerPort: defaultPeerPort, RPCPort: defaultRPCPort, + RESTPort: defaultRESTPort, MaxPendingChannels: defaultMaxPendingChannels, Bitcoin: &chainConfig{ RPCHost: defaultRPCHost, diff --git a/lnd.go b/lnd.go index fc97f4e2..3d872cc7 100644 --- a/lnd.go +++ b/lnd.go @@ -201,8 +201,9 @@ func lndMain() error { return err } go func() { - rpcsLog.Infof("gRPC proxy started") - http.ListenAndServe(":8080", mux) + restEndpoint := fmt.Sprintf(":%d", loadedConfig.RESTPort) + rpcsLog.Infof("gRPC proxy started at localhost%s", restEndpoint) + http.ListenAndServe(restEndpoint, mux) }() // If we're not in simnet mode, We'll wait until we're fully synced to