I have the following config I want to load with viper:
artist:
name: The Beatles
albums:
- name: The White Album
year: 1968
- name: Abbey Road
year: 1969
I can't work out how to load a list of maps. I guess I need to unmarshal just this key, but this code doesn't work:
type Album struct {
Name string
Year int
}
type Artist struct {
Name string
Albums []Album
}
var artist Artist
viper.UnmarshalKey("artists", &artist)
What am I missing?