Documentation
¶
Overview ¶
Package config provides Runa config primitives.
Index ¶
- func BindNamed(store *Store, scope string, group string, name string, target any) (bool, error)
- func BindProvider(ctx runaprovider.Context, scope string, key string, target any) error
- func LoadFiles(store *Store, configPath string, env string, prefixes ...string) error
- func Provider(basePath string, paths Paths, dir string, env string, prefixes ...string) runaprovider.Provider
- type EnvSource
- type FileSource
- type MapSource
- type Paths
- type Source
- type Store
- func (store *Store) Bind(key string, target any) error
- func (store *Store) Default(key string, value any) error
- func (store *Store) Get[T any](key string, fallback ...T) T
- func (store *Store) GetInt(key string, fallback int) int
- func (store *Store) GetString(key string, fallback string) string
- func (store *Store) Has(key string) bool
- func (store *Store) Load(sources ...Source) error
- func (store *Store) Reload() error
- func (store *Store) Scope(name string) *Store
- func (store *Store) Set(key string, value any) error
- func (store *Store) Values() map[string]any
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BindProvider ¶
BindProvider binds a provider-scoped config subtree into target.
Types ¶
type EnvSource ¶
type EnvSource struct {
Prefix string
}
EnvSource loads config values from environment variables.
type FileSource ¶
FileSource loads a TOML file.
func FileDomain ¶
func FileDomain(path string, domain string) FileSource
FileDomain creates a file config source scoped under a domain.
type Paths ¶
type Paths interface {
BasePath(paths ...string) string
AppPath(paths ...string) string
ConfigPath(paths ...string) string
DataPath(paths ...string) string
PublicPath(paths ...string) string
}
Paths resolves application paths for config placeholders.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store stores merged configuration values.
Click to show internal directories.
Click to hide internal directories.