config

package
v0.0.0-...-a670c85 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2025 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package config provides configuration management with environment variable support.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config map[string]any

Config represents a configuration map with string keys and any type values.

func (*Config) GetBool

func (c *Config) GetBool(key string) bool

func (*Config) GetFloat

func (c *Config) GetFloat(key string) float64

func (*Config) GetInt

func (c *Config) GetInt(key string) int

func (*Config) GetString

func (c *Config) GetString(key string) string

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.

Jump to

Keyboard shortcuts

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