Documentation
¶
Overview ¶
Package config provides configuration management with environment variable support.
Index ¶
- type Config
- type ConfigBuilder
- func (cb *ConfigBuilder) Build() *Config
- func (cb *ConfigBuilder) WithBoolDefault(key string, value bool) *ConfigBuilder
- func (cb *ConfigBuilder) WithFloatDefault(key string, value float64) *ConfigBuilder
- func (cb *ConfigBuilder) WithIntDefault(key string, value int) *ConfigBuilder
- func (cb *ConfigBuilder) WithStringDefault(key string, value string) *ConfigBuilder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConfigBuilder ¶
type ConfigBuilder struct {
// contains filtered or unexported fields
}
ConfigBuilder provides a fluent interface for building configuration with default values and automatic environment variable loading.
func NewConfigBuilder ¶
func NewConfigBuilder() *ConfigBuilder
NewConfigBuilder creates a new ConfigBuilder with initialized default maps.
func (*ConfigBuilder) Build ¶
func (cb *ConfigBuilder) Build() *Config
Build constructs the final Config by loading values from environment variables or using the configured defaults. All registered keys are processed and added to the Config.
func (*ConfigBuilder) WithBoolDefault ¶
func (cb *ConfigBuilder) WithBoolDefault(key string, value bool) *ConfigBuilder
WithBoolDefault sets a default boolean value for the given key. The value can be overridden by an environment variable with the same key name.
func (*ConfigBuilder) WithFloatDefault ¶
func (cb *ConfigBuilder) WithFloatDefault(key string, value float64) *ConfigBuilder
WithFloatDefault sets a default float64 value for the given key. The value can be overridden by an environment variable with the same key name.
func (*ConfigBuilder) WithIntDefault ¶
func (cb *ConfigBuilder) WithIntDefault(key string, value int) *ConfigBuilder
WithIntDefault sets a default integer value for the given key. The value can be overridden by an environment variable with the same key name.
func (*ConfigBuilder) WithStringDefault ¶
func (cb *ConfigBuilder) WithStringDefault(key string, value string) *ConfigBuilder
WithStringDefault sets a default string value for the given key. The value can be overridden by an environment variable with the same key name.