config

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2024 License: Apache-2.0 Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadConfig

func LoadConfig(prefix string, config any, defaults map[string]any) error

LoadConfig sets given defaults and read in given config.

Types

type BaseConfig

type BaseConfig struct {
	LogLevel   string            `mapstructure:"logLevel" envconfig:"LOG_LEVEL" default:"info"`
	IsDev      bool              `mapstructure:"isDev" envconfig:"IS_DEV" default:"false"`
	ListenAddr string            `mapstructure:"listenAddr" envconfig:"LISTEN_ADDR" default:"127.0.0.1"`
	ListenPort int               `mapstructure:"listenPort" envconfig:"LISTEN_PORT" default:"8080"`
	ServerMode server.ServerMode `mapstructure:"serverMode" default:"production"`
}

BaseConfig can be used to import the base config parameters in the applications config struct. Please use with tag `mapstructure:",squash"`.

Jump to

Keyboard shortcuts

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