From fa669ae4362549224d3c779a23b596358b460bcd Mon Sep 17 00:00:00 2001 From: Jae Kwon Date: Sat, 18 Apr 2015 16:43:48 -0700 Subject: [PATCH] added Moniker as config, available in RPC. --- config/config.go | 2 ++ rpc/core/net.go | 2 ++ rpc/core/types/responses.go | 1 + 3 files changed, 5 insertions(+) diff --git a/config/config.go b/config/config.go index 50a7292f5..00ae835fd 100644 --- a/config/config.go +++ b/config/config.go @@ -35,6 +35,7 @@ func SetApp(a *confer.Config) { var defaultConfig = `# This is a TOML config file. # For more information, see https://github.com/toml-lang/toml +Moniker = "anonymous" Network = "tendermint_testnet0" ListenAddr = "0.0.0.0:8080" # First node to connect to. Command-line overridable. @@ -86,6 +87,7 @@ var DefaultGenesis = `{ // NOTE: If you change this, maybe also change defaultConfig func initDefaults(rootDir string) { + app.SetDefault("Moniker", "anonymous") app.SetDefault("Network", "tendermint_testnet0") app.SetDefault("ListenAddr", "0.0.0.0:8080") app.SetDefault("DB.Backend", "leveldb") diff --git a/rpc/core/net.go b/rpc/core/net.go index a6036989e..3fcb37e13 100644 --- a/rpc/core/net.go +++ b/rpc/core/net.go @@ -33,6 +33,7 @@ func Status() (*ctypes.ResponseStatus, error) { func NetInfo() (*ctypes.ResponseNetInfo, error) { listening := p2pSwitch.IsListening() + moniker := config.App().GetString("Moniker") network := config.App().GetString("Network") listeners := []string{} for _, listener := range p2pSwitch.Listeners() { @@ -46,6 +47,7 @@ func NetInfo() (*ctypes.ResponseNetInfo, error) { }) } return &ctypes.ResponseNetInfo{ + Moniker: moniker, Network: network, Listening: listening, Listeners: listeners, diff --git a/rpc/core/types/responses.go b/rpc/core/types/responses.go index 35fed0e87..e7c71e259 100644 --- a/rpc/core/types/responses.go +++ b/rpc/core/types/responses.go @@ -70,6 +70,7 @@ type ResponseStatus struct { } type ResponseNetInfo struct { + Moniker string Network string Listening bool Listeners []string