浏览代码

add default value for content

Shelikhoo 4 年之前
父节点
当前提交
c05e37de45
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      infra/conf/v5cfg/common.go

+ 3 - 0
infra/conf/v5cfg/common.go

@@ -12,6 +12,9 @@ import (
 func loadHeterogeneousConfigFromRawJson(interfaceType, name string, rawJson json.RawMessage) (proto.Message, error) {
 	fsdef := envimpl.NewDefaultFileSystemDefaultImpl()
 	ctx := envctx.ContextWithEnvironment(context.TODO(), fsdef)
+	if rawJson == nil || len(rawJson) == 0 {
+		rawJson = []byte("{}")
+	}
 	return registry.LoadImplementationByAlias(ctx, interfaceType, name, []byte(rawJson))
 }