Versions in this module Expand all Collapse all v0 v0.2.0 Nov 16, 2026 v0.1.2 Nov 15, 2026 v0.1.1 Nov 15, 2026 v0.1.0 Nov 15, 2026 Changes in this version + var ErrInvalidSourceName = errors.New("gonf: source name must start with a scheme such as \"file:\"") + var ErrNameConflict = errors.New("gonf: keys with the same name") + var ErrNotFound = errors.New("gonf: key not found") + func Encode(prefix string, v any) (map[string]string, error) + func Escape(s string) string + func Scheme(name string) (string, bool) + func WriteMarkdown(w io.Writer, props []Property) error + type AnyMapping interface + Prefix func() string + type BindError struct + Prefix string + Problems []*Problem + func (e *BindError) Error() string + func (e *BindError) Unwrap() []error + type Config struct + func Load(ctx context.Context, opts ...Option) (*Config, error) + func (c *Config) Candidates(key string) []Value + func (c *Config) Eval(expr string) (string, error) + func (c *Config) Explain(key string) Explanation + func (c *Config) Explanations() []Explanation + func (c *Config) Get(key string) (string, error) + func (c *Config) Keys() []string + func (c *Config) Lookup(key string) (Value, bool) + func (c *Config) Profiles() []string + func (c *Config) Properties() []Property + func (c *Config) Sources() []SourceInfo + func (c *Config) Warnings() []Warning + type Explanation struct + Candidates []Value + Err error + Functions []string + IsDefault bool + IsSecret bool + Key string + Origin Origin + Property *Property + Value string + func (e Explanation) String() string + type Function struct + Call func(cfg *Config, arg string, origin Origin) (string, error) + IsSecret bool + Mapping AnyMapping + Name string + type KeyMapper interface + MapKey func(key string) string + type Live struct + func Watch(ctx context.Context, opts ...WatchOption) (*Live, error) + func (l *Live) Config() *Config + type MappedSource interface + LoadMapped func(ctx context.Context, keys []string) (map[string]Value, error) + type Mapping struct + func NewMapping[T any](prefix string, opts ...MappingOption) *Mapping[T] + func (m *Mapping[T]) Get(c *Config) T + func (m *Mapping[T]) Prefix() string + type MappingOption func(*bindOptions) + func AllowUnknown() MappingOption + type NameReporter interface + LoadReport func(ctx context.Context, keys, prefixes []string) (values map[string]Value, unknown []string, err error) + type Option func(*loadOptions) + func WithConverter[T any](convert func(s string) (T, error)) Option + func WithFactories(factories ...SourceFactory) Option + func WithFunctions(fns ...Function) Option + func WithMappings(mappings ...AnyMapping) Option + func WithProfileKey(key string) Option + func WithProfileSources(sources func(profile string) []Source) Option + func WithProfiles(names ...string) Option + func WithSecretWords(words ...string) Option + func WithSources(srcs ...Source) Option + func WithValidator(validate func(v any) error) Option + type OptionalSource interface + IsMissing func() bool + IsOptional func() bool + type Origin struct + Location string + Ordinal int + Profile string + Source string + type Problem struct + Err error + Key string + Origin Origin + func (p *Problem) Error() string + func (p *Problem) Unwrap() error + type ProfileSource interface + Profile func() string + type Property struct + Default *string + Doc string + Env string + IsUnknownAllowed bool + Key string + Location string + Mapping string + Required bool + Secret bool + Type string + func Describe(opts ...Option) ([]Property, error) + type Secret struct + func NewSecret[T any](v T) Secret[T] + func (s Secret[T]) Format(f fmt.State, _ rune) + func (s Secret[T]) LogValue() slog.Value + func (s Secret[T]) MarshalText() ([]byte, error) + func (s Secret[T]) String() string + func (s Secret[T]) Value() T + type Source interface + Load func(ctx context.Context) (map[string]Value, error) + Name func() string + Ordinal func() int + type SourceError struct + Err error + Source string + func (e *SourceError) Error() string + func (e *SourceError) Unwrap() error + type SourceFactory interface + Mapping func() AnyMapping + func NewFactory[T any](m *Mapping[T], create func(ctx context.Context, v T) ([]Source, error)) SourceFactory + type SourceInfo struct + IsMissing bool + IsOptional bool + Keys int + Name string + Ordinal int + Profile string + type Value struct + Origin Origin + Raw string + type VerbatimSource interface + IsVerbatim func() bool + type Warning struct + Keys []string + Kind WarningKind + Message string + Name string + Source string + func (w Warning) String() string + type WarningKind string + const WarnNameConflict + const WarnUnknownName + type WatchOption interface + func OnReload(fn func(cfg *Config, err error)) WatchOption + func WithLogger(l *slog.Logger) WatchOption + type Watcher interface + Watch func(ctx context.Context, changed func()) error