Support default env prefix
vipcxj opened this issue · comments
vipcxj commented
For example:
type Child struct {
Name string `default:"${ NAME | child-name }"`
}
type App struct {
Name string `default:"${ APP_NAME | my-app }"`
Env string `default:"${ APP_ENV | dev}"`
Debug bool `default:"${ APP_DEBUG | false}"`
Child1 Child `default:""`
Child2 Child `default:"" defaultenvprefix:"APP_CHILD_"`
}
App.Child1 will use env NAME as its default value, and App.Child2 will use APP_CHILD_NAME as its default value.
This feature completely decouples the Child from the App.
I will make a pr for it.