config

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2022 License: GPL-3.0 Imports: 9 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateDefaults added in v1.0.0

func ValidateDefaults(Chain Chain, ChainName string) error

Make sure the default parameter values can be parsed into the parameter types

func ValidateMetricDefaults added in v1.0.0

func ValidateMetricDefaults(Params []ClientParam) error

Make sure the default parameter values for the metrics section can be parsed into the parameter types

Types

type Chain

type Chain struct {
	Provider           string `yaml:"provider,omitempty"`
	WsProvider         string `yaml:"wsProvider,omitempty"`
	FallbackProvider   string `yaml:"fallbackProvider,omitempty"`
	FallbackWsProvider string `yaml:"fallbackWsProvider,omitempty"`
	ReconnectDelay     string `yaml:"reconnectDelay,omitempty"`
	PruneProvisioner   string `yaml:"pruneProvisioner,omitempty"`
	ChainID            string `yaml:"chainID,omitempty"`
	Client             struct {
		Options  []ClientOption `yaml:"options,omitempty"`
		Selected string         `yaml:"selected,omitempty"`
		Params   []UserParam    `yaml:"params,omitempty"`
	} `yaml:"client,omitempty"`
}

func (*Chain) GetClientById added in v1.0.0

func (chain *Chain) GetClientById(id string) *ClientOption

Get a client by it's ID

func (*Chain) GetSelectedClient

func (chain *Chain) GetSelectedClient() *ClientOption

type ClientOption

type ClientOption struct {
	ID                    string        `yaml:"id,omitempty"`
	Name                  string        `yaml:"name,omitempty"`
	Desc                  string        `yaml:"desc,omitempty"`
	Image                 string        `yaml:"image,omitempty"`
	BeaconImage           string        `yaml:"beaconImage,omitempty"`
	ValidatorImage        string        `yaml:"validatorImage,omitempty"`
	Link                  string        `yaml:"link,omitempty"`
	CompatibleEth2Clients string        `yaml:"compatibleEth2Clients,omitempty"`
	EventLogInterval      string        `yaml:"eventLogInterval,omitempty"`
	Supermajority         bool          `yaml:"supermajority,omitempty"`
	Params                []ClientParam `yaml:"params,omitempty"`
	Fallback              bool          `yaml:"fallback,omitempty"`
}

func (*ClientOption) GetBeaconImage

func (client *ClientOption) GetBeaconImage() string

Get the beacon & validator images for a client

func (*ClientOption) GetParamByEnvName added in v1.0.0

func (client *ClientOption) GetParamByEnvName(env string) *ClientParam

Get a client parameter by its environment variable name

func (*ClientOption) GetValidatorImage

func (client *ClientOption) GetValidatorImage() string

type ClientParam

type ClientParam struct {
	Name      string `yaml:"name,omitempty"`
	Desc      string `yaml:"desc,omitempty"`
	Env       string `yaml:"env,omitempty"`
	Required  bool   `yaml:"required,omitempty"`
	Regex     string `yaml:"regex,omitempty"`
	Type      string `yaml:"type,omitempty"`
	Default   string `yaml:"default,omitempty"`
	Max       string `yaml:"max,omitempty"`
	BlankText string `yaml:"blankText,omitempty"`
	Advanced  bool   `yaml:"advanced,omitempty"`
}

type Metrics added in v1.0.0

type Metrics struct {
	Enabled  bool          `yaml:"enabled,omitempty"`
	Params   []ClientParam `yaml:"params,omitempty"`
	Settings []UserParam   `yaml:"settings,omitempty"`
}

func (*Metrics) GetParamByEnvName added in v1.0.0

func (metrics *Metrics) GetParamByEnvName(env string) *ClientParam

Get a metrics parameter by its environment variable name

type RocketPoolConfig

type RocketPoolConfig struct {
	Rocketpool struct {
		StorageAddress       string `yaml:"storageAddress,omitempty"`
		OneInchOracleAddress string `yaml:"oneInchOracleAddress,omitempty"`
		RplTokenAddress      string `yaml:"rplTokenAddress,omitempty"`
		RPLFaucetAddress     string `yaml:"rplFaucetAddress,omitempty"`
	} `yaml:"rocketpool,omitempty"`
	Smartnode struct {
		ProjectName               string  `yaml:"projectName,omitempty"`
		GraffitiVersion           string  `yaml:"graffitiVersion,omitempty"`
		Image                     string  `yaml:"image,omitempty"`
		PasswordPath              string  `yaml:"passwordPath,omitempty"`
		WalletPath                string  `yaml:"walletPath,omitempty"`
		ValidatorKeychainPath     string  `yaml:"validatorKeychainPath,omitempty"`
		ValidatorRestartCommand   string  `yaml:"validatorRestartCommand,omitempty"`
		MaxFee                    float64 `yaml:"maxFee,omitempty"`
		MaxPriorityFee            float64 `yaml:"maxPriorityFee,omitempty"`
		GasLimit                  uint64  `yaml:"gasLimit,omitempty"`
		RplClaimGasThreshold      float64 `yaml:"rplClaimGasThreshold,omitempty"`
		MinipoolStakeGasThreshold float64 `yaml:"minipoolStakeGasThreshold,omitempty"`
		TxWatchUrl                string  `yaml:"txWatchUrl,omitempty"`
		StakeUrl                  string  `yaml:"stakeUrl,omitempty"`
	} `yaml:"smartnode,omitempty"`
	Chains struct {
		Eth1         Chain `yaml:"eth1,omitempty"`
		Eth1Fallback Chain `yaml:"eth1Fallback,omitempty"`
		Eth2         Chain `yaml:"eth2,omitempty"`
	} `yaml:"chains,omitempty"`
	Metrics Metrics `yaml:"metrics,omitempty"`
}

Rocket Pool config

func Load

func Load(c *cli.Context) (RocketPoolConfig, error)

Load merged config from files

func Merge

func Merge(configs ...*RocketPoolConfig) (RocketPoolConfig, error)

Merge configs

func Parse

func Parse(bytes []byte) (RocketPoolConfig, error)

Parse a config from yaml bytes

func (*RocketPoolConfig) GetGasLimit added in v1.0.0

func (config *RocketPoolConfig) GetGasLimit() (uint64, error)

Parse and return the gas limit

func (*RocketPoolConfig) GetMaxFee added in v1.1.0

func (config *RocketPoolConfig) GetMaxFee() (*big.Int, error)

Parse and return the max fee in wei

func (*RocketPoolConfig) GetMaxPriorityFee added in v1.1.0

func (config *RocketPoolConfig) GetMaxPriorityFee() (*big.Int, error)

Parse and return the max priority fee in wei

func (*RocketPoolConfig) GetSelectedEth1Client

func (config *RocketPoolConfig) GetSelectedEth1Client() *ClientOption

Get the selected clients from a config

func (*RocketPoolConfig) GetSelectedEth1FallbackClient added in v1.2.0

func (config *RocketPoolConfig) GetSelectedEth1FallbackClient() *ClientOption

func (*RocketPoolConfig) GetSelectedEth2Client

func (config *RocketPoolConfig) GetSelectedEth2Client() *ClientOption

func (*RocketPoolConfig) Serialize

func (config *RocketPoolConfig) Serialize() ([]byte, error)

Serialize a config to yaml bytes

type UserParam

type UserParam struct {
	Env   string `yaml:"env,omitempty"`
	Value string `yaml:"value"`
}

Jump to

Keyboard shortcuts

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