config

package
v0.1.21 Latest Latest
Warning

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

Go to latest
Published: May 1, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cluster

type Cluster struct {
	// Name is the Solana cluster this validator is running on. One of mainnet-beta or testnet
	Name string `koanf:"name"`
}

Cluster represents the Solana cluster configuration

func (*Cluster) Validate

func (c *Cluster) Validate() error

Validate validates the cluster configuration

type Config

type Config struct {
	// Log configuration
	Log Log `koanf:"log"`
	// Validator is the local validator configuration
	Validator Validator `koanf:"validator"`
	// Cluster is the Solana cluster configuration
	Cluster Cluster `koanf:"cluster"`
	// Sync is the version sync configuration
	Sync Sync `koanf:"sync"`
	// File is the file that the config was loaded from
	File string `koanf:"-"`
	// contains filtered or unexported fields
}

Config represents the complete configuration

func New

func New() (config *Config, err error)

New creates a new Config

func NewFromConfigFile

func NewFromConfigFile(configFile string) (*Config, error)

NewFromConfigFile creates a new Config from a config file path

func (*Config) Initialize

func (c *Config) Initialize() error

Initialize processes and validates the loaded configuration

func (*Config) LoadFromFile

func (c *Config) LoadFromFile(filePath string) error

LoadFromFile loads configuration from file into the struct

type Identities

type Identities struct {
	// Active is the path to the active identity keyfile
	ActiveKeyPairFile string `koanf:"active"`
	// Passive is the path to the passive identity keyfile
	PassiveKeyPairFile string `koanf:"passive"`
	// ActiveKeyPair is the loaded active keypair
	ActiveKeyPair solana.PrivateKey `koanf:"-"`
	// PassiveKeyPair is the loaded passive keypair
	PassiveKeyPair solana.PrivateKey `koanf:"-"`
}

Identities represents the validator identity configuration

func (*Identities) Load

func (i *Identities) Load() (err error)

Load loads the identity keypairs from files

type Log

type Log struct {
	// Level is the log level - one of "debug", "info", "warn", "error", "fatal", defaults to "info", overwritable by --log-level command line flag
	Level string `koanf:"level"`
	// Format is the log format - one of "text" or "json" or "logfmt", defaults to text
	Format string `koanf:"format"`
	// ParsedLevel is the parsed log level
	ParsedLevel log.Level `koanf:"-"`
	// ParsedFormat is the parsed log format
	ParsedFormatter log.Formatter `koanf:"-"`
}

Log represents the logging configuration

func (*Log) ConfigureWithLevelString

func (l *Log) ConfigureWithLevelString(logLevel string)

ConfigureWithLevelString configures the logger with the supplied settings If logLevel is provided and different from the config level, it overrides the config

func (*Log) SetLevelString

func (l *Log) SetLevelString(logLevel string)

SetLevelString sets the log level from a string

func (*Log) Validate

func (l *Log) Validate() (err error)

Validate validates the log configuration

type Sync

type Sync struct {
	// EnabledWhenActive enables sync when the validator is active
	EnabledWhenActive bool `koanf:"enabled_when_active"`
	// EnabledWhenNoActiveLeaderInGossip enables sync when there is no active leader in gossip
	EnabledWhenNoActiveLeaderInGossip bool `koanf:"enabled_when_no_active_leader_in_gossip"`
	// EnableSFDPCompliance enables SFDP compliance checking
	EnableSFDPCompliance bool `koanf:"enable_sfdp_compliance"`
	// Commands are the commands to run when there is a version change
	Commands []sync_commands.Command `koanf:"commands"`
}

Sync represents the version sync configuration

func (*Sync) SetDefaults

func (s *Sync) SetDefaults()

SetDefaults sets default values for the sync configuration

func (*Sync) Validate

func (s *Sync) Validate() error

Validate validates the sync configuration

type Validator

type Validator struct {
	// Client is the solana validator client - one of: agave, jito-solana, rakurai-validator, firedancer
	// The legacy alias "rakurai" is also accepted and normalized to "rakurai-validator".
	Client string `koanf:"client"`
	// RPCURL is the URL of the validator's RPC endpoint
	RPCURL string `koanf:"rpc_url"`
	// VersionConstraint is the constraint for the client version
	VersionConstraint string `koanf:"version_constraint"`
	// Identities are the paths to the active and passive identity keyfiles
	Identities Identities `koanf:"identities"`
}

Validator represents the validator configuration

func (*Validator) Validate

func (v *Validator) Validate() error

Validate validates the validator configuration

Jump to

Keyboard shortcuts

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