Packages
Search packages... ⌘K
Go Package
config
YAML configuration reader — typed config loading with environment overlay
Go Ready MD
Config Loading with Environment Override go
1 2 3 4 5 6 7 8 9 10 11 12
type AppConfig struct {
Server struct {
Port int `yaml:"port" required:"true"`
Host string `yaml:"host" default:"0.0.0.0"`
} `yaml:"server"`
Database database.Config `yaml:"database"`
}
// Load base config, then overlay dev-specific values
cfg, err := config.Load[AppConfig]("config.yml")
cfg, err = config.Overlay(cfg, "config.dev.yml")
err = config.Validate(cfg)About
Loads YAML configuration files into typed Go structs with environment variable overlay support. Validates required fields, applies defaults, and merges environment-specific overrides following a base-then-env cascade.
Public API
| Name | Kind | Signature |
|---|---|---|
| Load | func | func Load[T any](path string, opts ...Option) (*T, error) |
| Config | type | type Config struct |
| Overlay | func | func Overlay[T any](base *T, envPath string) (*T, error) |
| Validate | func | func Validate[T any](cfg *T) error |
Dependencies
Imported By (4)
database Go Ready
PostgreSQL adapter — connection pooling, schema isolation, health checks
postgresqlpgxpoolingschema-isolation
4 exports 5 deps
storage Go Ready
R2-compatible object storage — upload, download, presigned URLs
r2s3-compatibleobject-storagepresigned-urls
5 exports 3 deps
vault Go Ready
1Password vault adapter — credential retrieval, caching, op:// URI resolution
1passwordsecretscredentialsop-uri
5 exports 4 deps
adapter Go Ready
HTTP client adapter — standardized external API client with retry and auth
http-clientretryauthenticationexternal-api
5 exports 3 deps
Related Packages
Source
github.com/shredbx/sbx-core/pkg/config
yamlconfigurationenvironmenttyped-config