config

package
v1.8.13 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// File names from which we attempt to read configuration.
	DefaultConfigFiles = []string{"config.yml", "config.yaml"}

	// Launchd doesn't set root env variables, so there is default
	DefaultConfigDirs = []string{getCurrentDirectory(), "~/.iotex-analyser", "/usr/local/etc/iotex-analyser", "/etc/iotex-analyser"}
)
View Source
var (
	// Default is the default config
	Default = Config{
		Server: Server{
			Http: "",
			Addr: "/tmp/iotex-analyser.sock",
		},
		Iotex: Iotex{
			BatchSize: 64,
		},
		BlockDB: coredb.Config{
			NumRetries:            3,
			MaxCacheSize:          64,
			BlockStoreBatchSize:   16,
			V2BlocksToSplitDB:     1000000,
			Compressor:            "Snappy",
			CompressLegacy:        false,
			SplitDBSizeMB:         0,
			SplitDBHeight:         900000,
			HistoryStateRetention: 2000,
		},
		SubLogs: make(map[string]log.GlobalConfig),
		Genesis: genesis.Default,
	}
)

Functions

func EVMNetworkID added in v1.6.6

func EVMNetworkID() uint32

func FileExists

func FileExists(path string) (bool, error)

FileExists checks to see if a file exist at the provided path.

func FindDefaultConfigPath

func FindDefaultConfigPath() string

FindDefaultConfigPath returns the first path that contains a config file. If none of the combination of DefaultConfigDirs and DefaultConfigFiles contains a config file, return empty string.

func SetEVMNetworkID added in v1.6.6

func SetEVMNetworkID(id uint32)

Types

type Config

type Config struct {
	Genesis  genesis.Genesis             `yaml:"genesis"`
	Server   Server                      `yaml:"server"`
	Database Database                    `yaml:"database"`
	Iotex    Iotex                       `yaml:"iotex"`
	BlockDB  coredb.Config               `yaml:"blockDB"`
	Log      log.GlobalConfig            `yaml:"log" json:"-"`
	SubLogs  map[string]log.GlobalConfig `yaml:"subLogs" json:"-"`
}

func New

func New(path string) (cfg *Config, err error)

type Database

type Database struct {
	Driver   string `yaml:"driver" env:"DB_DRIVER"`
	Host     string `yaml:"host" env:"DB_HOST"`
	Port     string `yaml:"port" env:"DB_PORT"`
	User     string `yaml:"user"  env:"DB_USER"`
	Password string `yaml:"password"  env:"DB_PASSWORD"`
	Name     string `yaml:"name"  env:"DB_NAME"`
	Debug    bool   `yaml:"debug"  env:"DB_DEBUG"`
}

type Iotex

type Iotex struct {
	EVMNetworkID       uint32   `yaml:"evmNetworkID"`
	CrawlMode          bool     `yaml:"crawlMode"`
	CrawlHeight        []uint64 `yaml:"crawlHeight"`
	DisableRebuildDB   bool     `yaml:"disableRebuildDB"`
	CatchUpMode        bool     `yaml:"catchUpMode"`
	CatchUpStartHeight uint64   `yaml:"catchUpStartHeight"`
	ChainEndPoint      string   `yaml:"chainEndPoint" env:"IOTEX_CHAIN_END_POINT"`
	ChainInsecure      bool     `yaml:"chainInsecure"`
	BatchSize          uint64   `yaml:"batchSize"` //default 64, ~ 10 blocks
}

type Server

type Server struct {
	Http          string   `yaml:"http"`
	Addr          string   `yaml:"addr"`
	HTTPAdminPort int      `yaml:"httpAdminPort"`
	Plugins       []string `yaml:"plugins"`
}

Jump to

Keyboard shortcuts

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