config: Specify gRPC proxy port with --restport command line arg

This commit is contained in:
Max Fang 2017-06-09 18:19:14 -07:00 committed by Olaoluwa Osuntokun
parent e60a370d46
commit dc0ab06d91
2 changed files with 6 additions and 2 deletions

View File

@ -26,6 +26,7 @@ const (
defaultLogDirname = "logs" defaultLogDirname = "logs"
defaultLogFilename = "lnd.log" defaultLogFilename = "lnd.log"
defaultRPCPort = 10009 defaultRPCPort = 10009
defaultRESTPort = 8080
defaultPeerPort = 5656 defaultPeerPort = 5656
defaultRPCHost = "localhost" defaultRPCHost = "localhost"
defaultMaxPendingChannels = 1 defaultMaxPendingChannels = 1
@ -87,6 +88,7 @@ type config struct {
PeerPort int `long:"peerport" description:"The port to listen on for incoming p2p connections"` 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"` 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."` 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."` 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, LogDir: defaultLogDir,
PeerPort: defaultPeerPort, PeerPort: defaultPeerPort,
RPCPort: defaultRPCPort, RPCPort: defaultRPCPort,
RESTPort: defaultRESTPort,
MaxPendingChannels: defaultMaxPendingChannels, MaxPendingChannels: defaultMaxPendingChannels,
Bitcoin: &chainConfig{ Bitcoin: &chainConfig{
RPCHost: defaultRPCHost, RPCHost: defaultRPCHost,

5
lnd.go
View File

@ -201,8 +201,9 @@ func lndMain() error {
return err return err
} }
go func() { go func() {
rpcsLog.Infof("gRPC proxy started") restEndpoint := fmt.Sprintf(":%d", loadedConfig.RESTPort)
http.ListenAndServe(":8080", mux) 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 // If we're not in simnet mode, We'll wait until we're fully synced to