mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-01 19:39:21 +08:00
fix: process null value in yaml (#37418)
issue: #34298 fix key: null defined in the yaml file. viper will parse it as "", and yaml v3 will parse it as "null". Signed-off-by: xianliang.li <xianliang.li@zilliz.com>
This commit is contained in:
parent
9fe90bf357
commit
1b98bb423a
@ -96,9 +96,15 @@ func flattenNode(node *yaml.Node, parentKey string, result map[string]string) {
|
||||
|
||||
switch valueNode.Kind {
|
||||
case yaml.ScalarNode:
|
||||
// Scalar value, store it as a string
|
||||
result[lowerKey(fullKey)] = valueNode.Value
|
||||
result[formatKey(fullKey)] = valueNode.Value
|
||||
// handle null value
|
||||
if valueNode.Tag == "!!null" {
|
||||
result[lowerKey(fullKey)] = ""
|
||||
result[formatKey(fullKey)] = ""
|
||||
} else {
|
||||
// Scalar value, store it as a string
|
||||
result[lowerKey(fullKey)] = valueNode.Value
|
||||
result[formatKey(fullKey)] = valueNode.Value
|
||||
}
|
||||
case yaml.MappingNode:
|
||||
// Nested map, process recursively
|
||||
flattenNode(valueNode, fullKey, result)
|
||||
|
Loading…
Reference in New Issue
Block a user