feat: conf inherit (#2568)
* feat: add ValuerWithParent * feat: make etcd config inherit from parents * chore: add more tests * chore: add more tests * chore: add more comments * chore: refactor * chore: add more comments * fix: fix duplicated code and refactor * fix: remove unnecessary code * fix: fix test case for removing print * feat: support partial inherit
This commit is contained in:
@@ -8,6 +8,7 @@ type (
|
||||
// use context and OptionalDep option to determine the value of Optional
|
||||
// nothing to do with context.Context
|
||||
fieldOptionsWithContext struct {
|
||||
Inherit bool
|
||||
FromString bool
|
||||
Optional bool
|
||||
Options []string
|
||||
@@ -40,6 +41,10 @@ func (o *fieldOptionsWithContext) getDefault() (string, bool) {
|
||||
return o.Default, len(o.Default) > 0
|
||||
}
|
||||
|
||||
func (o *fieldOptionsWithContext) inherit() bool {
|
||||
return o != nil && o.Inherit
|
||||
}
|
||||
|
||||
func (o *fieldOptionsWithContext) optional() bool {
|
||||
return o != nil && o.Optional
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user