config

package
v0.0.0-...-8993a07 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2023 License: MIT Imports: 16 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load

func Load(ctx context.Context, cfg Config, opts ...Option) error

Load returns an error if - Config is not a pointer to struct - could not load configuration from env - could not validate config

otherwise it pass configuration to Config.

Types

type Base

type Base struct {
	Shutdown time.Duration `env:"SHUTDOWN_TIMEOUT" default:"5s" usage:"allows to set custom graceful shutdown timeout"`

	Ops    web.OpsConfig `env:"OPS"`
	Logger logger.Config `env:"LOGGER"`
	Tracer tracer.Config `env:"TRACER"`
}

Base contains base settings for go-bones modules. You can include it to your config file and use.

func (Base) Validate

func (b Base) Validate(ctx context.Context) error

Validate allows to validate base config and common libraries configs.

type Config

type Config interface {
	Validate(context.Context) error
}

Config interface that allows to set and validate project configuration.

type Option

type Option func(*config)

Option allows to set custom settings.

func WithArgs

func WithArgs(v []string) Option

WithArgs allows to set custom os.Args.

func WithEnvPath

func WithEnvPath(v string) Option

WithEnvPath allows to set environment file path.

func WithEnvs

func WithEnvs(v []string) Option

WithEnvs allows to set custom ENVs.

func WithVersion

func WithVersion(v string) Option

WithVersion allows to set current version.

Jump to

Keyboard shortcuts

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