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.
Click to show internal directories.
Click to hide internal directories.