Documentation
¶
Overview ¶
Package configspec provides the embedded luxd configuration specification.
Deprecated: Use github.com/luxfi/config/spec instead. This package will be removed in a future release. The canonical location for configspec is now github.com/luxfi/config/spec.
This is a snapshot of the node's configuration spec for use by SDK consumers without requiring a dependency on the node package.
The spec.json file is generated from the node using:
go run github.com/luxfi/node/cmd/config dump-spec --format=json > spec.json
To regenerate, run:
go generate ./...
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NodeVersion ¶
func NodeVersion() string
NodeVersion returns the node version this spec was generated from.
Types ¶
type Category ¶
type Category string
Category groups related configuration flags.
const ( CategoryProcess Category = "process" CategoryNode Category = "node" CategoryDatabase Category = "database" CategoryNetwork Category = "network" CategoryConsensus Category = "consensus" CategoryStaking Category = "staking" CategoryHTTP Category = "http" CategoryAPI Category = "api" CategoryHealth Category = "health" CategoryLogging Category = "logging" CategoryThrottler Category = "throttler" CategorySystem Category = "system" CategoryBootstrap Category = "bootstrap" CategoryChain Category = "chain" CategoryProfile Category = "profile" CategoryMetrics Category = "metrics" CategoryGenesis Category = "genesis" CategoryFees Category = "fees" CategoryIndex Category = "index" CategoryTracing Category = "tracing" CategoryPOA Category = "poa" CategoryDev Category = "dev" )
type ConfigSpec ¶
type ConfigSpec struct {
Version string `json:"version"`
NodeVersion string `json:"node_version"`
GeneratedAt string `json:"generated_at"`
Flags []FlagSpec `json:"flags"`
Categories map[Category]string `json:"categories"`
}
ConfigSpec is the complete specification of all luxd configuration flags.
func MustSpec ¶
func MustSpec() *ConfigSpec
MustSpec returns the embedded configuration specification or panics on error.
func Spec ¶
func Spec() (*ConfigSpec, error)
Spec returns the embedded configuration specification. The spec is parsed once and cached for subsequent calls.
func (*ConfigSpec) DeprecatedFlags ¶
func (s *ConfigSpec) DeprecatedFlags() []FlagSpec
DeprecatedFlags returns all deprecated flags.
func (*ConfigSpec) FlagsByCategory ¶
func (s *ConfigSpec) FlagsByCategory(cat Category) []FlagSpec
FlagsByCategory returns all flags in a specific category.
func (*ConfigSpec) GetFlag ¶
func (s *ConfigSpec) GetFlag(key string) *FlagSpec
GetFlag returns the spec for a specific flag, or nil if not found.
func (*ConfigSpec) KnownKey ¶
func (s *ConfigSpec) KnownKey(key string) bool
KnownKey returns true if the key is a known configuration flag.
type Constraints ¶
type Constraints struct {
Min interface{} `json:"min,omitempty"`
Max interface{} `json:"max,omitempty"`
Enum []string `json:"enum,omitempty"`
Pattern string `json:"pattern,omitempty"`
RequiredWith []string `json:"required_with,omitempty"`
ConflictsWith []string `json:"conflicts_with,omitempty"`
}
Constraints defines validation rules for a flag.
type FlagSpec ¶
type FlagSpec struct {
Key string `json:"key"`
Type FlagType `json:"type"`
Default interface{} `json:"default,omitempty"`
Description string `json:"description"`
Category Category `json:"category"`
Deprecated bool `json:"deprecated,omitempty"`
DeprecatedMessage string `json:"deprecated_message,omitempty"`
ReplacedBy string `json:"replaced_by,omitempty"`
Required bool `json:"required,omitempty"`
Sensitive bool `json:"sensitive,omitempty"`
Constraints *Constraints `json:"constraints,omitempty"`
Since string `json:"since,omitempty"`
}
FlagSpec describes a single configuration flag.
type FlagType ¶
type FlagType string
FlagType represents the type of a configuration flag.
const ( TypeBool FlagType = "bool" TypeInt FlagType = "int" TypeUint FlagType = "uint" TypeUint64 FlagType = "uint64" TypeFloat64 FlagType = "float64" TypeDuration FlagType = "duration" TypeString FlagType = "string" TypeStringSlice FlagType = "string-slice" TypeIntSlice FlagType = "int-slice" TypeStringToString FlagType = "string-to-string" )