config

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvPrefix = "ROBOT"
)

Variables

This section is empty.

Functions

func ValidateConfig added in v0.0.3

func ValidateConfig(cfg *Config) error

ValidateConfig validates config

Types

type BatchLimits

type BatchLimits struct {
	BatchBlocksCountLimit uint          `mapstructure:"batchBlocksCountLimit"`
	BatchLenLimit         uint          `mapstructure:"batchLenLimit"`
	BatchSizeLimit        uint          `mapstructure:"batchSizeLimit"`
	BatchTimeoutLimit     time.Duration `mapstructure:"batchTimeoutLimit"`
}

type Config

type Config struct {
	LogLevel string `mapstructure:"logLevel" validate:"required"`
	LogType  string `mapstructure:"logType" validate:"required"`

	ServerPort uint `mapstructure:"serverPort"`

	ProfilePath string `mapstructure:"profilePath" validate:"required"`
	UserName    string `mapstructure:"userName" validate:"required"`

	TxSwapPrefix           string        `mapstructure:"txSwapPrefix" validate:"required"`
	TxMultiSwapPrefix      string        `mapstructure:"txMultiSwapPrefix" validate:"required"`
	TxPreimagePrefix       string        `mapstructure:"txPreimagePrefix" validate:"required"`
	DelayAfterChRobotError time.Duration `mapstructure:"delayAfterChRobotError"`

	DefaultBatchLimits *BatchLimits `mapstructure:"defaultBatchLimits"`

	RedisStorage *RedisStorage `mapstructure:"redisStor" validate:"required"`

	PromMetrics *PromMetrics `mapstructure:"promMetrics"`

	DefaultRobotExecOpts ExecuteOptions `mapstructure:"defaultRobotExecOpts"`
	Robots               []*Robot       `mapstructure:"robots" validate:"required,dive"`
}

func GetConfig

func GetConfig() (*Config, error)

func GetConfigFromPath added in v0.0.3

func GetConfigFromPath(cfgPath string) (*Config, error)

GetConfigFromPath returns config from specified path

func (Config) WithoutSensitiveData

func (c Config) WithoutSensitiveData() Config

WithoutSensitiveData returns copy of config with empty sensitive data. This config might be used for trace logging.

type ExecuteOptions

type ExecuteOptions struct {
	ExecuteTimeout *time.Duration `mapstructure:"executeTimeout"`
}

func (ExecuteOptions) EffExecuteTimeout

func (eo ExecuteOptions) EffExecuteTimeout(defOpts ExecuteOptions) (time.Duration, error)

type PromMetrics

type PromMetrics struct {
	PrefixForMetrics string `mapstructure:"prefix"`
}

type RedisStorage

type RedisStorage struct {
	DBPrefix string   `mapstructure:"dbPrefix"`
	Addr     []string `mapstructure:"addr"`
	Password string   `mapstructure:"password"`
	WithTLS  bool     `mapstructure:"withTLS"`
	RootCAs  []string `mapstructure:"rootCAs"`
}

type Robot

type Robot struct {
	ChName              string         `mapstructure:"chName" validate:"required"`
	InitMinExecBlockNum uint64         `mapstructure:"initExecBlockNum"`
	SrcChannels         []*SrcChannel  `mapstructure:"src" validate:"required,dive"`
	BatchLimits         *BatchLimits   `mapstructure:"batchLimits"`
	CollectorsBufSize   uint           `mapstructure:"collectorsBufSize"`
	ExecOpts            ExecuteOptions `mapstructure:"execOpts"`
}

type SrcChannel

type SrcChannel struct {
	ChName       string  `mapstructure:"chName" validate:"required"`
	InitBlockNum *uint64 `mapstructure:"initBlockNum" validate:"required"`
}

Jump to

Keyboard shortcuts

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