config

package
v0.0.0-...-e3220b9 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

type Logger interface {
	Log(ctx context.Context, level slog.Level, msg string, args ...any)
}

type Option

type Option func(*options)

func WithEnv

func WithEnv(prefix string, replacerOldNewPairs ...string) Option

func WithEnvFile

func WithEnvFile(file string, prefix string, replacerOldNewPairs ...string) Option

func WithFile

func WithFile(file string) Option

WithFile load config in the given file Also load env config from the same directory <fileName>.env

func WithLogger

func WithLogger(log Logger) Option

func WithOnChange

func WithOnChange(f func(in fsnotify.Event)) Option

func WithPaths

func WithPaths(name string, typ string, paths ...string) Option

WithPaths looks for named configs in the given paths Also load environment variables from <name>.env in the given paths

func WithRemote

func WithRemote(typ string, provider, endpoint, path string) Option

func WithRemoteSecured

func WithRemoteSecured(typ string, provider, endpoint, path string, secret string) Option

type Reader

type Reader[T any] struct {
	// contains filtered or unexported fields
}

func MustNewReader

func MustNewReader[T any](opts ...Option) *Reader[T]

func NewReader

func NewReader[T any](opts ...Option) (*Reader[T], error)

func (*Reader[T]) Read

func (r *Reader[T]) Read(ctx context.Context) (*T, error)

func (*Reader[T]) WriteEnv

func (r *Reader[T]) WriteEnv(w io.Writer)

Jump to

Keyboard shortcuts

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