Documentation
¶
Index ¶
- Variables
- func Commands(manager *Manager) *cli.Command
- type Manager
- func (m *Manager) GetValue(key string) (string, string, error)
- func (m *Manager) GlobalPath() string
- func (m *Manager) ListAll() (map[string]ValueWithSource, error)
- func (m *Manager) LocalPath() string
- func (m *Manager) ReadConfig() (proto.Message, error)
- func (m *Manager) SetGlobalPath(path string)
- func (m *Manager) SetLocalPath(path string)
- func (m *Manager) SetServiceName(serviceName string)
- func (m *Manager) SetValue(path string, keyValues map[string]string) error
- func (m *Manager) WriteConfig(path string, msg proto.Message) error
- type ValueWithSource
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidArgument is returned when a command line argument is invalid ErrInvalidArgument = errors.New("invalid argument format") // ErrKeyValueRequired is returned when at least one key=value pair is required ErrKeyValueRequired = errors.New("at least one key=value pair required") // ErrExactlyOneKey is returned when exactly one key is required ErrExactlyOneKey = errors.New("exactly one key required") )
var ( // ErrInvalidKey is returned when a config key doesn't exist in the schema ErrInvalidKey = errors.New("invalid config key") // ErrListNotSupported is returned when attempting to set a list/array field ErrListNotSupported = errors.New("setting list fields not supported, edit config file manually") )
Functions ¶
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager handles configuration file operations
func NewManager ¶
NewManager creates a new config manager for the given proto message type
func (*Manager) GetValue ¶
GetValue retrieves a config value by dot-notation key (e.g., "server.host") Returns the value and the source (file path or "default")
func (*Manager) GlobalPath ¶
GlobalPath returns the global config file path
func (*Manager) ListAll ¶
func (m *Manager) ListAll() (map[string]ValueWithSource, error)
ListAll returns all config values with their sources
func (*Manager) ReadConfig ¶
ReadConfig reads and merges config from global and local files Returns the merged config, with local taking precedence over global
func (*Manager) SetGlobalPath ¶
SetGlobalPath sets a custom global config path
func (*Manager) SetLocalPath ¶
SetLocalPath sets a custom local config path
func (*Manager) SetServiceName ¶
SetServiceName sets the service name for service-scoped config
type ValueWithSource ¶
ValueWithSource holds a config value and its source