typesafeconfig

package
v1.45.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

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

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 WithActiveProfiles(profiles ...string) Option

func WithAdditionalDirectories added in v1.3.0

func WithAdditionalDirectories(directories ...string) Option

func WithBaseConfigurationNames added in v1.3.0

func WithBaseConfigurationNames(baseNames ...string) Option

func WithDirectories added in v1.3.0

func WithDirectories(directories ...string) Option

func WithEmbeddedFilesystems added in v1.3.0

func WithEmbeddedFilesystems(embeddedFilesystems ...*embed.FS) Option

func WithExplicitProperties added in v1.3.0

func WithExplicitProperties[T string | map[string]any](properties ...T) Option

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL