conf

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2021 License: Apache-2.0 Imports: 10 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.yml"                    // default config file path
	SPVConfig          = &LocalConfig{}                         // 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"`
	SyncInterval   int32              `mapstructure:"sync_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)

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

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