conf

package
v0.0.0-...-81d58bd Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitConfig

func InitConfig[T any](opts types.ConfigOptions) (*T, error)

InitConfig initializes a viper configuration and returns a pointer to the configuration struct.

Example:

confStruct := conf.ConfigStruct{
	Place:    "Gotham",
	Event:    "Joker's Robbery",
	Duration: 24,
}

opts := types.ConfigOptions{
	Domain: "org.gotham.events",
	Prefix: "/tmp",
	Type:   "yml",
}

config, err := conf.InitConfig[conf.ConfigStruct](opts)
if err != nil {
	fmt.Printf("error initializing config: %v", err)
}

fmt.Printf("The event %s at %s will last for %d hours", config.Event, config.Place, config.Duration)

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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