MCPcopy Create free account
hub / github.com/devfullcycle/goexpert / LoadConfig

Function LoadConfig

20-CleanArch/configs/config.go:17–33  ·  view source on GitHub ↗
(path string)

Source from the content-addressed store, hash-verified

15}
16
17func LoadConfig(path string) (*conf, error) {
18 var cfg *conf
19 viper.SetConfigName("app_config")
20 viper.SetConfigType("env")
21 viper.AddConfigPath(path)
22 viper.SetConfigFile(".env")
23 viper.AutomaticEnv()
24 err := viper.ReadInConfig()
25 if err != nil {
26 panic(err)
27 }
28 err = viper.Unmarshal(&cfg)
29 if err != nil {
30 panic(err)
31 }
32 return cfg, err
33}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected