config

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterConfigFlags added in v1.3.0

func RegisterConfigFlags(flags *flag.FlagSet)

Types

type Config

type Config struct {
	App              string `koanf:"-"`
	LogLevel         string `koanf:"log-level" validate:"ValidateLogLevel"`
	LogFormat        string `koanf:"log-format" validate:"in:console,json"`
	URL              string `koanf:"url"`
	ApiKey           string `koanf:"api-key"`
	ApiKeyFile       string `koanf:"api-key-file"`
	Port             int    `koanf:"port" validate:"required"`
	Interface        string `koanf:"interface" validate:"required|ip"`
	DisableSSLVerify bool   `koanf:"disable-ssl-verify"`
	// contains filtered or unexported fields
}

func LoadConfig

func LoadConfig(flags *flag.FlagSet) (*Config, error)

func (Config) Messages

func (c Config) Messages() map[string]string

func (Config) Translates

func (c Config) Translates() map[string]string

func (*Config) Validate

func (c *Config) Validate() error

func (Config) ValidateLogLevel

func (c Config) ValidateLogLevel(val string) bool

ValidateLogLevel validates that the log level is one of the valid log levels gookit/Validate is pretty opinionated, and requires that this is not a pointer method.

Jump to

Keyboard shortcuts

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