OSDN Git Service

Merge pull request #1829 from Bytom/dashboard
[bytom/bytom.git] / config / config.go
index 4e66838..666b14f 100644 (file)
@@ -10,7 +10,7 @@ import (
 
        log "github.com/sirupsen/logrus"
 
-       "github.com/bytom/crypto/ed25519"
+       "github.com/bytom/bytom/crypto/ed25519"
 )
 
 var (
@@ -87,6 +87,9 @@ type BaseConfig struct {
        // This should be set in viper so it can unmarshal into this struct
        RootDir string `mapstructure:"home"`
 
+       //The alias of the node
+       NodeAlias string `mapstructure:"node_alias"`
+
        //The ID of the network to json
        ChainID string `mapstructure:"chain_id"`
 
@@ -127,6 +130,8 @@ func DefaultBaseConfig() BaseConfig {
                DBBackend:         "leveldb",
                DBPath:            "data",
                KeysPath:          "keystore",
+               NodeAlias:         "",
+               LogFile:           "log",
        }
 }
 
@@ -134,6 +139,10 @@ func (b BaseConfig) DBDir() string {
        return rootify(b.DBPath, b.RootDir)
 }
 
+func (b BaseConfig) LogDir() string {
+       return rootify(b.LogFile, b.RootDir)
+}
+
 func (b BaseConfig) KeysDir() string {
        return rootify(b.KeysPath, b.RootDir)
 }
@@ -145,6 +154,7 @@ type P2PConfig struct {
        PrivateKey       string `mapstructure:"node_key"`
        NodeKeyFile      string `mapstructure:"node_key_file"`
        SkipUPNP         bool   `mapstructure:"skip_upnp"`
+       LANDiscover      bool   `mapstructure:"lan_discoverable"`
        MaxNumPeers      int    `mapstructure:"max_num_peers"`
        HandshakeTimeout int    `mapstructure:"handshake_timeout"`
        DialTimeout      int    `mapstructure:"dial_timeout"`
@@ -160,6 +170,7 @@ func DefaultP2PConfig() *P2PConfig {
                ListenAddress:    "tcp://0.0.0.0:46656",
                NodeKeyFile:      "nodekey",
                SkipUPNP:         false,
+               LANDiscover:      true,
                MaxNumPeers:      50,
                HandshakeTimeout: 30,
                DialTimeout:      3,
@@ -173,6 +184,7 @@ func DefaultP2PConfig() *P2PConfig {
 type WalletConfig struct {
        Disable  bool   `mapstructure:"disable"`
        Rescan   bool   `mapstructure:"rescan"`
+       TxIndex  bool   `mapstructure:"txindex"`
        MaxTxFee uint64 `mapstructure:"max_tx_fee"`
 }
 
@@ -212,6 +224,7 @@ func DefaultWalletConfig() *WalletConfig {
        return &WalletConfig{
                Disable:  false,
                Rescan:   false,
+               TxIndex:  false,
                MaxTxFee: uint64(1000000000),
        }
 }