config

package
v0.4.2-dev Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: AGPL-3.0 Imports: 15 Imported by: 3

Documentation

Index

Constants

View Source
const (
	ModulesName         string = "modules"
	ValidatorsDirectory string = "validators"
)
View Source
const (
	EventLogInterval            int    = 1000
	HyperdriveDaemonRoute       string = "hyperdrive"
	HyperdriveApiVersion        string = "1"
	HyperdriveApiClientRoute    string = HyperdriveDaemonRoute + "/api/v" + HyperdriveApiVersion
	HyperdriveCliSocketFilename string = HyperdriveDaemonRoute + "-cli.sock"
	HyperdriveNetSocketFilename string = HyperdriveDaemonRoute + "-net.sock"
	ConfigFilename              string = "user-settings.yml"

	// Wallet
	UserAddressFilename    string = "address"
	UserWalletDataFilename string = "wallet"
	UserPasswordFilename   string = "password"

	// Scripts
	EcStartScript string = "start-ec.sh"
	BnStartScript string = "start-bn.sh"
	VcStartScript string = "start-vc.sh"

	// HTTP
	ClientTimeout time.Duration = 1 * time.Minute

	// Volumes
	ExecutionClientDataVolume string = "ecdata"
	BeaconNodeDataVolume      string = "bndata"

	// Logging
	LogDir       string = "logs"
	ApiLogName   string = "api.log"
	TasksLogName string = "tasks.log"
)
View Source
const (
	// The NodeSet dev network on Holesky
	Network_HoleskyDev config.Network = "holesky-dev"
)

Variables

This section is empty.

Functions

func NewLocalBeaconClient

func NewLocalBeaconClient() *config.LocalBeaconConfig

Create a new LocalBeaconClient struct

func NewLocalExecutionClient

func NewLocalExecutionClient() *config.LocalExecutionConfig

Create a new LocalExecutionClient struct

func NewMetricsConfig

func NewMetricsConfig() *config.MetricsConfig

Generates a new metrics config

Types

type HyperdriveConfig

type HyperdriveConfig struct {
	// General settings
	Network            config.Parameter[config.Network]
	ClientMode         config.Parameter[config.ClientMode]
	ProjectName        config.Parameter[string]
	UserDataPath       config.Parameter[string]
	AutoTxMaxFee       config.Parameter[float64]
	MaxPriorityFee     config.Parameter[float64]
	AutoTxGasThreshold config.Parameter[float64]

	// Logging
	Logging *config.LoggerConfig

	// Execution client settings
	LocalExecutionClient    *config.LocalExecutionConfig
	ExternalExecutionClient *config.ExternalExecutionConfig

	// Beacon node settings
	LocalBeaconClient    *config.LocalBeaconConfig
	ExternalBeaconClient *config.ExternalBeaconConfig

	// Fallback clients
	Fallback *config.FallbackConfig

	// Metrics
	Metrics *config.MetricsConfig

	// Modules
	Modules map[string]any

	// Internal fields
	Version string
	// contains filtered or unexported fields
}

The master configuration struct

func LoadFromFile

func LoadFromFile(path string) (*HyperdriveConfig, error)

Load configuration settings from a file

func NewHyperdriveConfig

func NewHyperdriveConfig(hdDir string) *HyperdriveConfig

Creates a new Hyperdrive configuration instance

func (*HyperdriveConfig) AutoTxGasThresholdInt

func (cfg *HyperdriveConfig) AutoTxGasThresholdInt() uint64

func (*HyperdriveConfig) AutoTxMaxFeeInt

func (cfg *HyperdriveConfig) AutoTxMaxFeeInt() uint64

func (*HyperdriveConfig) BeaconNodeContainerName

func (c *HyperdriveConfig) BeaconNodeContainerName() string

func (*HyperdriveConfig) BeaconNodeDataVolume

func (c *HyperdriveConfig) BeaconNodeDataVolume() string

func (*HyperdriveConfig) BnHttpUrl

func (cfg *HyperdriveConfig) BnHttpUrl() (string, error)

func (*HyperdriveConfig) BnRpcUrl

func (cfg *HyperdriveConfig) BnRpcUrl() (string, error)

func (*HyperdriveConfig) ChangeNetwork

func (cfg *HyperdriveConfig) ChangeNetwork(newNetwork config.Network)

Changes the current network, propagating new parameter settings if they are affected

func (*HyperdriveConfig) Clone

func (cfg *HyperdriveConfig) Clone() *HyperdriveConfig

Creates a copy of the configuration

func (*HyperdriveConfig) DaemonContainerName

func (c *HyperdriveConfig) DaemonContainerName() string

func (*HyperdriveConfig) Deserialize

func (cfg *HyperdriveConfig) Deserialize(masterMap map[string]any) error

Deserializes a settings file into this config

func (*HyperdriveConfig) ExecutionClientContainerName

func (c *HyperdriveConfig) ExecutionClientContainerName() string

func (*HyperdriveConfig) ExecutionClientDataVolume

func (c *HyperdriveConfig) ExecutionClientDataVolume() string

func (*HyperdriveConfig) ExporterContainerName

func (c *HyperdriveConfig) ExporterContainerName() string

func (*HyperdriveConfig) FallbackBnHttpUrl

func (cfg *HyperdriveConfig) FallbackBnHttpUrl() string

func (*HyperdriveConfig) FallbackBnRpcUrl

func (cfg *HyperdriveConfig) FallbackBnRpcUrl() string

func (*HyperdriveConfig) GetApiLogFilePath

func (cfg *HyperdriveConfig) GetApiLogFilePath() string

func (*HyperdriveConfig) GetBeaconHostname

func (cfg *HyperdriveConfig) GetBeaconHostname() (string, error)

Gets the hostname portion of the Beacon Node's URI. Used by text/template to format prometheus.yml.

func (*HyperdriveConfig) GetBeaconNodeUrls

func (cfg *HyperdriveConfig) GetBeaconNodeUrls() (string, string)

func (*HyperdriveConfig) GetBnAdditionalFlags

func (cfg *HyperdriveConfig) GetBnAdditionalFlags() (string, error)

Used by text/template to format bn.yml

func (*HyperdriveConfig) GetBnContainerTag

func (cfg *HyperdriveConfig) GetBnContainerTag() (string, error)

Gets the tag of the bn container Used by text/template to format bn.yml

func (*HyperdriveConfig) GetBnHttpEndpoint

func (cfg *HyperdriveConfig) GetBnHttpEndpoint() string

Get the HTTP API endpoint for the provided BN

func (*HyperdriveConfig) GetBnHttpEndpointsWithFallback

func (cfg *HyperdriveConfig) GetBnHttpEndpointsWithFallback() string

Get the endpoints of the BN, including the fallback if applicable

func (*HyperdriveConfig) GetBnMaxPeers

func (cfg *HyperdriveConfig) GetBnMaxPeers() (uint16, error)

Gets the max peers of the bn container Used by text/template to format bn.yml

func (*HyperdriveConfig) GetBnOpenPorts

func (cfg *HyperdriveConfig) GetBnOpenPorts() []string

Used by text/template to format bn.yml

func (*HyperdriveConfig) GetBnStartScript

func (cfg *HyperdriveConfig) GetBnStartScript() string

Gets the name of the Beacon Node start script

func (*HyperdriveConfig) GetDaemonContainerTag

func (cfg *HyperdriveConfig) GetDaemonContainerTag() string

func (*HyperdriveConfig) GetDockerArtifactName

func (cfg *HyperdriveConfig) GetDockerArtifactName(entity string) string

Gets the full name of the Docker container or volume with the provided suffix (name minus the project ID prefix)

func (*HyperdriveConfig) GetEcAdditionalFlags

func (cfg *HyperdriveConfig) GetEcAdditionalFlags() (string, error)

Used by text/template to format ec.yml

func (*HyperdriveConfig) GetEcContainerTag

func (cfg *HyperdriveConfig) GetEcContainerTag() (string, error)

Gets the tag of the ec container Used by text/template to format ec.yml

func (*HyperdriveConfig) GetEcHttpEndpoint

func (cfg *HyperdriveConfig) GetEcHttpEndpoint() string

Used by text/template to format bn.yml

func (*HyperdriveConfig) GetEcHttpEndpointsWithFallback

func (cfg *HyperdriveConfig) GetEcHttpEndpointsWithFallback() string

Get the endpoints of the EC, including the fallback if applicable

func (*HyperdriveConfig) GetEcMaxPeers

func (cfg *HyperdriveConfig) GetEcMaxPeers() (uint16, error)

Gets the max peers of the ec container Used by text/template to format ec.yml

func (*HyperdriveConfig) GetEcOpenApiPorts

func (cfg *HyperdriveConfig) GetEcOpenApiPorts() string

Gets the port mapping of the ec container Used by text/template to format ec.yml

func (*HyperdriveConfig) GetEcStartScript

func (cfg *HyperdriveConfig) GetEcStartScript() string

Gets the name of the Execution Client start script

func (*HyperdriveConfig) GetEcWsEndpoint

func (cfg *HyperdriveConfig) GetEcWsEndpoint() string

Used by text/template to format bn.yml

func (*HyperdriveConfig) GetExecutionClientUrls

func (cfg *HyperdriveConfig) GetExecutionClientUrls() (string, string)

func (*HyperdriveConfig) GetExecutionHostname

func (cfg *HyperdriveConfig) GetExecutionHostname() (string, error)

Gets the hostname portion of the Execution Client's URI. Used by text/template to format prometheus.yml.

func (*HyperdriveConfig) GetExporterAdditionalFlags

func (cfg *HyperdriveConfig) GetExporterAdditionalFlags() []string

Used by text/template to format exporter.yml

func (*HyperdriveConfig) GetExternalIP

func (cfg *HyperdriveConfig) GetExternalIP() string

Used by text/template to format ec.yml

func (*HyperdriveConfig) GetLoggerOptions

func (cfg *HyperdriveConfig) GetLoggerOptions() log.LoggerOptions

func (*HyperdriveConfig) GetModuleLogFilePath

func (cfg *HyperdriveConfig) GetModuleLogFilePath(moduleName string, moduleLogName string) string

func (*HyperdriveConfig) GetNetworkResources

func (cfg *HyperdriveConfig) GetNetworkResources() *config.NetworkResources

func (*HyperdriveConfig) GetNodeAddressFilePath

func (cfg *HyperdriveConfig) GetNodeAddressFilePath() string

func (*HyperdriveConfig) GetParameters

func (cfg *HyperdriveConfig) GetParameters() []config.IParameter

Get the config.Parameters for this config

func (*HyperdriveConfig) GetPasswordFilePath

func (cfg *HyperdriveConfig) GetPasswordFilePath() string

func (*HyperdriveConfig) GetPrometheusAdditionalFlags

func (cfg *HyperdriveConfig) GetPrometheusAdditionalFlags() []string

Used by text/template to format prometheus.yml

func (*HyperdriveConfig) GetPrometheusOpenPorts

func (cfg *HyperdriveConfig) GetPrometheusOpenPorts() string

Used by text/template to format prometheus.yml

func (*HyperdriveConfig) GetSelectedBeaconNode

func (cfg *HyperdriveConfig) GetSelectedBeaconNode() config.BeaconNode

Get the selected Beacon Node

func (*HyperdriveConfig) GetSelectedExecutionClient

func (cfg *HyperdriveConfig) GetSelectedExecutionClient() config.ExecutionClient

Get the selected Beacon Node

func (*HyperdriveConfig) GetSubconfigs

func (cfg *HyperdriveConfig) GetSubconfigs() map[string]config.IConfigSection

Get the subconfigurations for this config

func (*HyperdriveConfig) GetTasksLogFilePath

func (cfg *HyperdriveConfig) GetTasksLogFilePath() string

func (*HyperdriveConfig) GetTitle

func (cfg *HyperdriveConfig) GetTitle() string

Get the title for this config

func (*HyperdriveConfig) GetUserDirectory

func (cfg *HyperdriveConfig) GetUserDirectory() string

func (*HyperdriveConfig) GetVcStartScript

func (cfg *HyperdriveConfig) GetVcStartScript() string

Gets the name of the Validator Client start script

func (*HyperdriveConfig) GetWalletFilePath

func (cfg *HyperdriveConfig) GetWalletFilePath() string

func (*HyperdriveConfig) GrafanaContainerName

func (c *HyperdriveConfig) GrafanaContainerName() string

func (*HyperdriveConfig) GraffitiPrefix

func (cfg *HyperdriveConfig) GraffitiPrefix() string

Used by text/template to format validator.yml Only returns the the prefix

func (*HyperdriveConfig) IsLocalMode

func (cfg *HyperdriveConfig) IsLocalMode() bool

Used by text/template to format bn.yml

func (*HyperdriveConfig) PrometheusContainerName

func (c *HyperdriveConfig) PrometheusContainerName() string

func (*HyperdriveConfig) Serialize

func (cfg *HyperdriveConfig) Serialize(modules []IModuleConfig, includeUserDir bool) map[string]any

Serializes the configuration into a map of maps, compatible with a settings file

type IModuleConfig

type IModuleConfig interface {
	config.IConfigSection

	// Get the name of the module
	GetModuleName() string

	// Get the short name of the module, for things like prefixing
	GetShortName() string

	// The name to use for the Hyperdrive Client log file
	GetHdClientLogFileName() string

	// The name to use for the API log file
	GetApiLogFileName() string

	// The name to use for the tasks log file
	GetTasksLogFileName() string

	// Get the list of all log file names used by the module
	GetLogNames() []string

	// A map of the Validator Client IDs to their container tags
	GetValidatorContainerTagInfo() map[config.ContainerID]string

	// Return if doppelganger detection is enabled for any of the VCs
	IsDoppelgangerEnabled() bool

	// True if the module is enabled
	IsEnabled() bool

	// Get the list of containers that should be deployed
	GetContainersToDeploy() []config.ContainerID

	// Handle a network change, for example by updating the default parameters
	ChangeNetwork(oldNetwork config.Network, newNetwork config.Network)

	// Create a copy of this config
	Clone() IModuleConfig

	// Update the default parameters based on the Hyperdrive config's current network value
	UpdateDefaults(network config.Network)

	// Verify the current settings and publish a list of errors that must be resolved before saving
	Validate() []string

	// Serialize the module config to a map
	Serialize() map[string]any

	// Deserialize the module config from a map
	Deserialize(configMap map[string]any, network config.Network) error

	// Get the version of the module config
	GetVersion() string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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