conf

package
v0.0.0-...-f30a169 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 3, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

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"
)

Variables

View Source
var (
	Filepath           = "../config/spv_config.yml"             // default config file path
	SPVConfig          = &Config{}                              // global config containing all chains' spv config
	RemoteChainConfigs = make(map[string]*protogo.RemoteConfig) // all remote chains' config got by sdk
)

Functions

func InitSPVConfig

func InitSPVConfig(cmd *cobra.Command) error

InitSPVConfig inits SPVConfig when deployed independently

func InitSPVConfigWithYmlFile

func InitSPVConfigWithYmlFile(ymlFile string) error

InitSPVConfigWithYmlFile inits SPVConfig when integrated as a component

Types

type ChainConfig

type ChainConfig struct {
	ChainType                  string             `mapstructure:"chain_type"`
	ChainId                    string             `mapstructure:"chain_id"`
	SyncChainInfoIntervalMills int32              `mapstructure:"sync_chainInfo_interval"`
	SDKConfigPath              string             `mapstructure:"sdk_config_path"`
	FabricConfig               *FabricExtraConfig `mapstructure:"fabric_extra_config"`
}

ChainConfig is the config of one chain's spv config

type Config

type Config struct {
	Chains        []*ChainConfig    `mapstructure:"chains"`
	GRPCConfig    *GRPCConfig       `mapstructure:"grpc"`
	WebConfig     *WebConfig        `mapstructure:"web"`
	StorageConfig *StoreConfig      `mapstructure:"storage"`
	LogConfig     *logger.LogConfig `mapstructure:"log"`
}

Config is the config containing all chains' spv config

type FabricExtraConfig

type FabricExtraConfig struct {
	User  string  `mapstructure:"user"`
	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"`
}

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 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 WebConfig

type WebConfig struct {
	Address string `mapstructure:"address"`
	Port    int    `mapstructure:"port"`
}

WebConfig is the config of web module

func (*WebConfig) ToUrl

func (webConfig *WebConfig) ToUrl() string

ToUrl return url of web config

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL