You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
2.5 KiB

  1. package config
  2. // Config struct for a Tendermint node
  3. type Config struct {
  4. // The ID of the chain to join (should be signed with every transaction and vote)
  5. ChainID string `mapstructure:"chain_id"`
  6. // A JSON file containing the initial validator set and other meta data
  7. GenesisFile string `mapstructure:"genesis_file"`
  8. // A JSON file containing the private key to use as a validator in the consensus protocol
  9. PrivValidatorFile string `mapstructure:"priv_validator_file"`
  10. // A custom human readable name for this node
  11. Moniker string `mapstructure:"moniker"`
  12. // TCP or UNIX socket address of the ABCI application,
  13. // or the name of an ABCI application compiled in with the Tendermint binary
  14. ProxyApp string `mapstructure:"proxy_app"`
  15. // Mechanism to connect to the ABCI application: socket | grpc
  16. ABCI string `mapstructure:"abci"`
  17. // Output level for logging
  18. LogLevel string `mapstructure:"log_level"`
  19. // TCP or UNIX socket address for the profiling server to listen on
  20. ProfListenAddress string `mapstructure:"prof_laddr"`
  21. // If this node is many blocks behind the tip of the chain, FastSync
  22. // allows them to catchup quickly by downloading blocks in parallel
  23. // and verifying their commits
  24. FastSync bool `mapstructure:"fast_sync"`
  25. // If true, query the ABCI app on connecting to a new peer
  26. // so the app can decide if we should keep the connection or not
  27. FilterPeers bool `mapstructure:"filter_peers"` // false
  28. // What indexer to use for transactions
  29. TxIndex string `mapstructure:"tx_index"`
  30. // Database backend: leveldb | memdb
  31. DBBackend string `mapstructure:"db_backend"`
  32. // Database directory
  33. DBDir string `mapstructure:"db_dir"`
  34. // TCP or UNIX socket address for the RPC server to listen on
  35. RPCListenAddress string `mapstructure:"rpc_laddr"`
  36. // TCP or UNIX socket address for the gRPC server to listen on
  37. // NOTE: This server only supports /broadcast_tx_commit
  38. GRPCListenAddress string `mapstructure:"grpc_laddr"`
  39. }
  40. func NewDefaultConfig(rootDir string) *Config {
  41. return &Config{
  42. GenesisFile: rootDir + "/genesis.json",
  43. PrivValidatorFile: rootDir + "/priv_validator.json",
  44. Moniker: "anonymous",
  45. ProxyApp: "tcp://127.0.0.1:46658",
  46. ABCI: "socket",
  47. LogLevel: "info",
  48. ProfListenAddress: "",
  49. FastSync: true,
  50. FilterPeers: false,
  51. TxIndex: "kv",
  52. DBBackend: "leveldb",
  53. DBDir: rootDir + "/data",
  54. RPCListenAddress: "tcp://0.0.0.0:46657",
  55. GRPCListenAddress: "",
  56. }
  57. }