Documentation
¶
Overview ¶
Package spec provides a machine-readable specification of all luxd configuration flags. This is the single source of truth for configuration - all consumers (CLI, SDK, netrunner) should derive their flag knowledge from this spec.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
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 is the spec version (semver)
Version string `json:"version"`
// NodeVersion is the luxd version this spec was generated from
NodeVersion string `json:"node_version"`
// GeneratedAt is when this spec was generated (RFC3339)
GeneratedAt string `json:"generated_at"`
// Flags contains all flag specifications
Flags []FlagSpec `json:"flags"`
// Categories lists all categories with descriptions
Categories map[Category]string `json:"categories"`
}
ConfigSpec is the complete specification of all luxd configuration flags.
func Spec ¶
func Spec() *ConfigSpec
Spec returns the complete configuration specification. This is the single source of truth for all luxd flags.
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) JSON ¶
func (s *ConfigSpec) JSON() ([]byte, error)
JSON returns the spec as formatted JSON.
type Constraints ¶
type Constraints struct {
// Min is the minimum value (for numeric types)
Min interface{} `json:"min,omitempty"`
// Max is the maximum value (for numeric types)
Max interface{} `json:"max,omitempty"`
// Enum lists allowed values (for string types)
Enum []string `json:"enum,omitempty"`
// Pattern is a regex pattern (for string types)
Pattern string `json:"pattern,omitempty"`
// RequiredWith lists flags that must also be set
RequiredWith []string `json:"required_with,omitempty"`
// ConflictsWith lists flags that cannot be set together
ConflictsWith []string `json:"conflicts_with,omitempty"`
}
Constraints defines validation rules for a flag.
type FlagSpec ¶
type FlagSpec struct {
// Key is the flag name (e.g., "network-id", "log-level")
Key string `json:"key"`
// Type is the flag's data type
Type FlagType `json:"type"`
// Default is the default value (nil if no default)
Default interface{} `json:"default,omitempty"`
// Description is the human-readable documentation
Description string `json:"description"`
// Category groups related flags for organization
Category Category `json:"category"`
// Deprecated indicates if this flag is deprecated
Deprecated bool `json:"deprecated,omitempty"`
// DeprecatedMessage explains what to use instead
DeprecatedMessage string `json:"deprecated_message,omitempty"`
// ReplacedBy is the key of the replacement flag (if deprecated)
ReplacedBy string `json:"replaced_by,omitempty"`
// Required indicates if this flag must be explicitly set
Required bool `json:"required,omitempty"`
// Sensitive indicates if the value should be masked in logs
Sensitive bool `json:"sensitive,omitempty"`
// Constraints contains validation rules
Constraints *Constraints `json:"constraints,omitempty"`
// Since indicates when this flag was introduced (version string)
Since string `json:"since,omitempty"`
}
FlagSpec describes a single configuration flag.
func (*FlagSpec) ValidateValue ¶
ValidateValue checks if a value is valid for a 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" )