I have the following yaml
openapi 3
config' for my servers:
servers:
- url: "localhost"
description: "localhost development server"
variables:
port:
default: ":10000"
Getting at those values via viper
is trivial without that pesky dash, but I'm struggling with it (which is necessary to make the yaml
openapi 3
compliant.
Doing this:
servers := viper.Get("servers")
fmt.Println(reflect.TypeOf(servers))
fmt.Println(servers)
Tells me this:
[]interface {}
[map[description:localhost development server url:localhost variables:map[port:map[default::10000]]]]
But my n00bie golang
abilities are lacking the ninja skillz to retrieve that :10000
value for port
.
Any help much appreciated!