kelseyhightower / envconfig

Golang library for managing configuration data from environment variables
MIT License
5.01k stars 377 forks source link

Syntax for map of structs or other maps #174

Closed a-urth closed 4 years ago

a-urth commented 4 years ago

Syntax for map of scalar values is defined in readme and pretty straightforward in form of key: value

But whats the syntax for config with field being map of structs or other maps? Or is it possible in general? Example

type Config struct {
    API map[string]APIConfig `required:"true"`
}

type APIConfig struct {
    Host    string            `required:"true"`
    Headers map[string]string `required:"false"`
}
a-urth commented 4 years ago

Ok, I see, because of how map is parsed its impossible.