config

package
v0.0.0-...-3fab451 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChainConfig

type ChainConfig struct {
	HttpClientConfig HttpClientConfig `mapstructure:"HTTP_CLIENT_CONFIG"`
	ApiEndpoint      string           `mapstructure:"API_ENDPOINT"`
	ApiKey           string           `mapstructure:"API_KEY"`
}

type Config

type Config struct {
	PgConfig               PgConfig           `mapstructure:"PG_CONFIG"`
	BaseEventMonitorConfig EventMonitorConfig `mapstructure:"BASE_EVENT_MONITOR_CONFIG"`
}

func LoadConfig

func LoadConfig(logger *zap.Logger) *Config

type EventMonitorConfig

type EventMonitorConfig struct {
	Enabled                    bool        `mapstructure:"ENABLED"`
	ChainConfig                ChainConfig `mapstructure:"CHAIN_CONFIG"`
	PollInterval               int64       `mapstructure:"POLL_INTERVAL"`     // in seconds
	QueryMaxBlocks             int64       `mapstructure:"QUERY_MAX_BLOCKS"`  // maximum blocks in each query
	MaxBlockRetries            int64       `mapstructure:"MAX_BLOCK_RETRIES"` // maximum retries on failure for each block1
	BlockDistance              int64       `mapstructure:"BLOCK_DISTANCE"`    // the distance to the latest block
	MonitoredContractAddresses []string    `mapstructure:"MONITORED_CONTRACT_ADDRESSES"`
}

type HttpClientConfig

type HttpClientConfig struct {
	DebugEnabled bool  `mapstructure:"DEBUG_ENABLED"`
	RateLimit    int64 `mapstructure:"RATE_LIMIT"` // request per second
}

type PgConfig

type PgConfig struct {
	Schema          string `mapstructure:"SCHEMA"`
	Url             string `mapstructure:"URL"`
	DebugEnabled    bool   `mapstructure:"DEBUG_ENABLED"`
	MaxIdleConns    int64  `mapstructure:"MAX_IDLE_CONNS"`
	MaxOpenConns    int64  `mapstructure:"MAX_OPEN_CONNS"`
	MaxConnLifeTime int64  `mapstructure:"MAX_CONN_LIFETIME"`  // in seconds
	MaxConnIdleTime int64  `mapstructure:"MAX_CONN_IDLE_TIME"` // in seconds
}

Jump to

Keyboard shortcuts

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