config

package
v0.0.0-...-5061215 Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvPrefix = "ROBOT"
)

Variables

This section is empty.

Functions

This section is empty.

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

	// can be local, vault, google
	CryptoSrc            CryptoSrc             `mapstructure:"cryptoSrc" validate:"required"`
	VaultCryptoSettings  *VaultCryptoSettings  `mapstructure:"vaultCryptoSettings"`
	GoogleCryptoSettings *GoogleCryptoSettings `mapstructure:"googleCryptoSettings"`

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

func GetConfig

func GetConfig() (*Config, error)

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 CryptoSrc

type CryptoSrc string
const (
	LocalCryptoSrc  CryptoSrc = "local"
	VaultCryptoSrc  CryptoSrc = "vault"
	GoogleCryptoSrc CryptoSrc = "google"
)

type ExecuteOptions

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

func (ExecuteOptions) EffExecuteTimeout

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

type GoogleCryptoSettings

type GoogleCryptoSettings struct {
	GcloudProject string `mapstructure:"gcloudProject"`
	GcloudCreds   string `mapstructure:"gcloudCreds"`
	UserCert      string `mapstructure:"userCert"`
}

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:"dive"`
	BatchLimits         *BatchLimits   `mapstructure:"batchLimits"`
	CollectorsBufSize   uint           `mapstructure:"collectorsBufSize"`
	ExecOpts            ExecuteOptions `mapstructure:"execOpts" validate:"dive"`
}

type SrcChannel

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

type VaultCryptoSettings

type VaultCryptoSettings struct {
	VaultToken              string `mapstructure:"vaultToken"`
	UseRenewableVaultTokens bool   `mapstructure:"useRenewableVaultTokens"`
	VaultAddress            string `mapstructure:"vaultAddress"`
	VaultAuthPath           string `mapstructure:"vaultAuthPath"`
	VaultRole               string `mapstructure:"vaultRole"`
	VaultServiceTokenPath   string `mapstructure:"vaultServiceTokenPath"`
	VaultNamespace          string `mapstructure:"vaultNamespace"`
	UserCert                string `mapstructure:"userCert"`
}

Jump to

Keyboard shortcuts

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