config

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2021 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"`
	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"`
}

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"`
		GasPrice                string `yaml:"gasPrice,omitempty"`
		GasLimit                string `yaml:"gasLimit,omitempty"`
		RplClaimGasThreshold    string `yaml:"rplClaimGasThreshold,omitempty"`
		TxWatchUrl              string `yaml:"txWatchUrl,omitempty"`
		StakeUrl                string `yaml:"stakeUrl,omitempty"`
	} `yaml:"smartnode,omitempty"`
	Chains struct {
		Eth1 Chain `yaml:"eth1,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) GetGasPrice added in v1.0.0

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

Parse and return the gas price in wei

func (*RocketPoolConfig) GetSelectedEth1Client

func (config *RocketPoolConfig) GetSelectedEth1Client() *ClientOption

Get the selected clients from a config

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