Documentation
¶
Overview ¶
Package config provides file-based configuration loading with validation.
Stability: stable
Package config provides file-based configuration loading with validation and environment variable overrides.
Load reads a JSON file into a struct. LoadWithEnv additionally applies environment variable overrides using the "env" struct tag. Validate checks fields with the "validate" struct tag.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadWithEnv ¶
LoadWithEnv reads a JSON configuration file and applies environment variable overrides. Fields with an `env:"NAME"` struct tag are overridden by the environment variable PREFIX_NAME if set.
Supported field types: string, int, bool.
Types ¶
type DistributedConfig ¶
type DistributedConfig struct {
CoordinatorAddress string `env:"COORDINATOR_ADDRESS" json:"coordinator_address" validate:"required"`
TimeoutSeconds int `env:"TIMEOUT_SECONDS" json:"timeout_seconds"`
TLSEnabled bool `env:"TLS_ENABLED" json:"tls_enabled"`
}
DistributedConfig holds configuration for distributed training.
type EngineConfig ¶
type EngineConfig struct {
Device string `env:"DEVICE" json:"device" validate:"required"`
MemoryLimitMB int `env:"MEMORY_LIMIT_MB" json:"memory_limit_mb"`
LogLevel string `env:"LOG_LEVEL" json:"log_level"`
}
EngineConfig holds configuration for the compute engine.
type TrainingConfig ¶
type TrainingConfig struct {
BatchSize int `env:"BATCH_SIZE" json:"batch_size" validate:"required"`
LearningRate string `env:"LEARNING_RATE" json:"learning_rate" validate:"required"`
Optimizer string `env:"OPTIMIZER" json:"optimizer" validate:"required"`
Epochs int `env:"EPOCHS" json:"epochs"`
CheckpointInterval int `env:"CHECKPOINT_INTERVAL" json:"checkpoint_interval"`
}
TrainingConfig holds configuration for training workflows.