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.
139 lines
2.8 KiB
139 lines
2.8 KiB
4 years ago
|
package main
|
||
|
|
||
|
import nodeconfig "github.com/harmony-one/harmony/internal/configs/node"
|
||
|
|
||
4 years ago
|
const tomlConfigVersion = "1.0.0"
|
||
4 years ago
|
|
||
|
const (
|
||
4 years ago
|
defNetworkType = nodeconfig.Mainnet
|
||
4 years ago
|
)
|
||
4 years ago
|
|
||
|
var defaultConfig = harmonyConfig{
|
||
|
Version: tomlConfigVersion,
|
||
|
General: generalConfig{
|
||
|
NodeType: "validator",
|
||
4 years ago
|
NoStaking: false,
|
||
4 years ago
|
ShardID: -1,
|
||
|
IsArchival: false,
|
||
|
DataDir: "./",
|
||
|
},
|
||
|
Network: getDefaultNetworkConfig(defNetworkType),
|
||
|
P2P: p2pConfig{
|
||
|
IP: "127.0.0.1",
|
||
|
Port: nodeconfig.DefaultP2PPort,
|
||
|
KeyFile: "./.hmykey",
|
||
|
},
|
||
|
RPC: rpcConfig{
|
||
|
Enabled: true,
|
||
|
IP: "127.0.0.1",
|
||
|
Port: nodeconfig.DefaultRPCPort,
|
||
|
},
|
||
|
WS: wsConfig{
|
||
|
Enabled: true,
|
||
|
IP: "127.0.0.1",
|
||
|
Port: nodeconfig.DefaultWSPort,
|
||
|
},
|
||
|
BLSKeys: blsConfig{
|
||
|
KeyDir: "./hmy/blskeys",
|
||
|
KeyFiles: nil,
|
||
|
MaxKeys: 10,
|
||
|
|
||
|
PassEnabled: true,
|
||
|
PassSrcType: blsPassTypeAuto,
|
||
|
PassFile: "",
|
||
|
SavePassphrase: false,
|
||
|
KMSEnabled: true,
|
||
|
KMSConfigSrcType: kmsConfigTypeShared,
|
||
|
KMSConfigFile: "",
|
||
|
},
|
||
|
Consensus: consensusConfig{
|
||
|
DelayCommit: "0ms",
|
||
|
BlockTime: "8s",
|
||
|
MinPeers: 32,
|
||
|
},
|
||
|
TxPool: txPoolConfig{
|
||
|
BlacklistFile: "./.hmy/blacklist.txt",
|
||
|
BroadcastInvalidTx: false,
|
||
|
},
|
||
|
Pprof: pprofConfig{
|
||
|
Enabled: false,
|
||
|
ListenAddr: "127.0.0.1:6060",
|
||
|
},
|
||
|
Log: logConfig{
|
||
|
Folder: "./latest",
|
||
|
FileName: "harmony.log",
|
||
|
RotateSize: 100,
|
||
|
Verbosity: 3,
|
||
|
},
|
||
|
}
|
||
|
|
||
|
var defaultDevnetConfig = devnetConfig{
|
||
|
NumShards: 2,
|
||
|
ShardSize: 10,
|
||
|
HmyNodeSize: 10,
|
||
|
}
|
||
|
|
||
|
var defaultRevertConfig = revertConfig{
|
||
|
RevertBeacon: false,
|
||
|
RevertBefore: 0,
|
||
|
RevertTo: 0,
|
||
|
}
|
||
|
|
||
|
var defaultLogContext = logContext{
|
||
|
IP: "127.0.0.1",
|
||
|
Port: 9000,
|
||
|
}
|
||
|
|
||
4 years ago
|
func getDefaultHmyConfigCopy(nt nodeconfig.NetworkType) harmonyConfig {
|
||
4 years ago
|
config := defaultConfig
|
||
4 years ago
|
|
||
|
config.Network = getDefaultNetworkConfig(nt)
|
||
|
if nt == nodeconfig.Devnet {
|
||
|
devnet := getDefaultDevnetConfigCopy()
|
||
|
config.Devnet = &devnet
|
||
|
}
|
||
4 years ago
|
return config
|
||
|
}
|
||
|
|
||
|
func getDefaultDevnetConfigCopy() devnetConfig {
|
||
|
config := defaultDevnetConfig
|
||
|
return config
|
||
|
}
|
||
|
|
||
|
func getDefaultRevertConfigCopy() revertConfig {
|
||
|
config := defaultRevertConfig
|
||
|
return config
|
||
|
}
|
||
|
|
||
|
func getDefaultLogContextCopy() logContext {
|
||
|
config := defaultLogContext
|
||
|
return config
|
||
|
}
|
||
|
|
||
|
const (
|
||
|
nodeTypeValidator = "validator"
|
||
|
nodeTypeExplorer = "explorer"
|
||
|
)
|
||
|
|
||
|
const (
|
||
|
blsPassTypeAuto = "auto"
|
||
|
blsPassTypeFile = "file"
|
||
|
blsPassTypePrompt = "prompt"
|
||
|
|
||
|
kmsConfigTypeShared = "shared"
|
||
|
kmsConfigTypePrompt = "prompt"
|
||
|
kmsConfigTypeFile = "file"
|
||
|
|
||
|
legacyBLSPassTypeDefault = "default"
|
||
|
legacyBLSPassTypeStdin = "stdin"
|
||
|
legacyBLSPassTypeDynamic = "no-prompt"
|
||
|
legacyBLSPassTypePrompt = "prompt"
|
||
|
legacyBLSPassTypeStatic = "file"
|
||
|
legacyBLSPassTypeNone = "none"
|
||
|
|
||
|
legacyBLSKmsTypeDefault = "default"
|
||
|
legacyBLSKmsTypePrompt = "prompt"
|
||
|
legacyBLSKmsTypeFile = "file"
|
||
|
legacyBLSKmsTypeNone = "none"
|
||
|
)
|