Documentation ¶
Overview ¶
Package typesafeconfig is for resolving configurations from many sources into a typesafe object
Quickstart:
import . "github.com/armory-io/go-commons/typesafeconfig" type MyConfiguration struct { prop1 string boolProp bool someList []string } conf := ResolveConfiguration[MyConfiguration](log, WithBaseConfigurationNames("myappname"), // defaults to application WithActiveProfiles("prod"), )
Index ¶
- Variables
- func ResolveConfiguration[T any](log *zap.SugaredLogger, options ...Option) (*T, error)
- type Option
- func WithActiveProfiles(profiles ...string) Option
- func WithAdditionalDirectories(directories ...string) Option
- func WithBaseConfigurationNames(baseNames ...string) Option
- func WithDirectories(directories ...string) Option
- func WithEmbeddedFilesystems(embeddedFilesystems ...*embed.FS) Option
- func WithExplicitProperties[T string | map[string]any](properties ...T) Option
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoConfigurationSourcesProvided = errors.New("no configuration sources provided, you must provide at least 1 embed.FS or dir path")
Functions ¶
func ResolveConfiguration ¶ added in v0.4.2
func ResolveConfiguration[T any](log *zap.SugaredLogger, options ...Option) (*T, error)
ResolveConfiguration given the provided options resolves your configuration
Types ¶
type Option ¶
type Option = func(resolver *resolver)
func WithActiveProfiles ¶ added in v1.3.0
func WithAdditionalDirectories ¶ added in v1.3.0
func WithBaseConfigurationNames ¶ added in v1.3.0
func WithDirectories ¶ added in v1.3.0
func WithEmbeddedFilesystems ¶ added in v1.3.0
Click to show internal directories.
Click to hide internal directories.