W
Size: a a a
p
W
W
MD
ЕК
A
type AppConfig struct {
name string `yaml:"name"`
checks []string `yaml:"checks"`
useSsl bool `yaml:"use_ssl"`
skip bool `yaml:"skip"`
}
type Config struct {
applications []AppConfig `yaml:"applications"`
}
viper.SetConfigName("applications")
viper.AddConfigPath("cfg")
viper.SetConfigType("yaml")
var configuration Config
if err := viper.ReadInConfig(); err != nil {
log.Fatalf("Error reading checks file, %s", err)
}
err := viper.Unmarshal(&configuration)
if err != nil {
log.Fatalf("unable to decode into struct, %v", err)
}
fmt.Println(configuration)
applications:
- name: "app1"
checks:
- "/liveness"
use_ssl: false
skip: false
A
A