-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Description
Hello guy,
Thanks for this work, this is really great.
I have an idea that I'd want to implement in gonfig but I want to have your advice first.
The optionFromField function takes the field name and build the id from it using this code :
id := f.Tag.Get(fieldTagID)
if len(id) == 0 {
id = strings.ToLower(f.Name)
}
opt.id = idProblem is when I have for example the struct field LogLevel, I'd want my config file corresponding field to be log_level.
I can obviously define my struct field like that
type ServerConfiguration struct {
Port int `env:"SERVER_PORT" default:"8080"`
LogLevel string `id:"log_level" env:"SERVER_LOG_LEVEL" default:"<root>=ERROR"`
}But I'd prefer to count on a default behaviour.
There I have an issue, what to choose as default behavior :
- snake case :
log_level - camel case :
logLevel
Maybe we could use as default what you already implemented, but have the possibility to override it in the gonfig.Conf what do you think about it ?
See you !
Metadata
Metadata
Assignees
Labels
No labels