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:
@@ -15,6 +15,7 @@ import (
|
||||
|
||||
const (
|
||||
defaultOption = "default"
|
||||
inheritOption = "inherit"
|
||||
stringOption = "string"
|
||||
optionalOption = "optional"
|
||||
optionsOption = "options"
|
||||
@@ -335,6 +336,8 @@ func parseNumberRange(str string) (*numberRange, error) {
|
||||
|
||||
func parseOption(fieldOpts *fieldOptions, fieldName, option string) error {
|
||||
switch {
|
||||
case option == inheritOption:
|
||||
fieldOpts.Inherit = true
|
||||
case option == stringOption:
|
||||
fieldOpts.FromString = true
|
||||
case strings.HasPrefix(option, optionalOption):
|
||||
|
||||
Reference in New Issue
Block a user