Documentation
¶
Overview ¶
Package conf contains the logic to read and initialize system configuration
Index ¶
Constants ¶
View Source
const ( ChainMakerSPV = "chainmaker_spv" ChainMakerLight = "chainmaker_light" FabricSPV = "fabric_spv" )
spv type
Variables ¶
View Source
var ( // Filepath is default config file path Filepath = "../config/spv.yml" // SPVConfig global config containing all chains' spv config SPVConfig = &LocalConfig{} // RemoteChainConfigs all remote chains' config got by sdk RemoteChainConfigs = make(map[string]*protogo.RemoteConfig) )
Functions ¶
func InitSPVConfig ¶
InitSPVConfig inits SPVConfig when deployed independently
Types ¶
type ChainConfig ¶
type ChainConfig struct { ChainType string `mapstructure:"chain_type"` ChainId string `mapstructure:"chain_id"` SyncInterval int32 `mapstructure:"sync_interval"` BlockInterval int32 `mapstructure:"block_interval"` ConcurrentNums int32 `mapstructure:"concurrent_nums"` SDKConfigPath string `mapstructure:"sdk_config_path"` FabricConfig *FabricExtraConfig `mapstructure:"fabric_extra_config"` }
ChainConfig is the config of one chain's spv config
type FabricExtraConfig ¶
type FabricExtraConfig struct {
Peers []*Peer `mapstructure:"peers"`
}
FabricExtraConfig is the extra config of fabric, containing user and peers
type GRPCConfig ¶
type GRPCConfig struct { Address string `mapstructure:"address"` Port int `mapstructure:"port"` EnableTLS bool `mapstructure:"enable_tls"` Security *TransportSecurity `mapstructure:"security"` }
GRPCConfig is the config of gRPC module
func (*GRPCConfig) ToUrl ¶
func (gRPCConfig *GRPCConfig) ToUrl() string
ToUrl return url of grpc config
type LevelDBConfig ¶
type LevelDBConfig struct { StorePath string `mapstructure:"store_path"` WriteBufferSize int `mapstructure:"write_buffer_size"` BloomFilterBits int `mapstructure:"bloom_filter_bits"` }
LevelDBConfig is the config of leveldb module
type LocalConfig ¶
type LocalConfig struct { Chains []*ChainConfig `mapstructure:"chains"` GRPCConfig *GRPCConfig `mapstructure:"grpc"` WebConfig *WebConfig `mapstructure:"web"` StorageConfig *StoreConfig `mapstructure:"storage"` LogConfig *logger.LogConfig `mapstructure:"log"` }
LocalConfig is the config containing all chains' spv config
func (*LocalConfig) GetChainConfig ¶
func (c *LocalConfig) GetChainConfig(chainId string) (*ChainConfig, error)
GetChainConfig get chain config
type Peer ¶
type Peer struct {
PeerName string `mapstructure:"peer"`
}
Peer contains the peer name of fabric
type StoreConfig ¶
type StoreConfig struct { Provider string `mapstructure:"provider"` LevelDB *LevelDBConfig `mapstructure:"leveldb"` }
StoreConfig is the config of storage module
type TransportSecurity ¶
type TransportSecurity struct { EnableCertAuth bool `mapstructure:"ca_auth"` CAFile []string `mapstructure:"ca_file"` CertFile string `mapstructure:"cert_file"` KeyFile string `mapstructure:"key_file"` }
TransportSecurity 传输安全配置
type WebConfig ¶
type WebConfig struct { Address string `mapstructure:"address"` Port int `mapstructure:"port"` EnableTLS bool `mapstructure:"enable_tls"` Security *TransportSecurity `mapstructure:"security"` }
WebConfig is the config of web module
Click to show internal directories.
Click to hide internal directories.