当我查看cryptogen
(fabric命令)配置文件时。我看到那里的象征。
Profiles:
SampleInsecureSolo:
Orderer:
<<: *OrdererDefaults ## what is the `<<`
Organizations:
- *ExampleCom ## what is the `*`
Consortiums:
SampleConsortium:
Organizations:
- *Org1ExampleCom
- *Org2ExampleCom
上面有两个符号<<
和*
。
Application: &ApplicationDefaults # what is the `&` mean
Organizations:
如您所见,还有另一个符号&
。我不知道那是什么意思。即使查看源代码(fabric/common/configtx/tool/configtxgen/main.go
),我也没有任何信息
好的,这些是YAML文件格式的元素,此处用于为提供配置文件configtxgen
。“&”符号表示锚,而对锚的引用是“ *”,基本上用于避免重复,例如:
person: &person
name: "John Doe"
employee: &employee
<< : *person
salary : 5000
将重用人员字段,其含义类似于:
employee: &employee
name : "John Doe"
salary : 5000
另一个例子就是简单地重用值:
key1: &key some very common value
key2: *key
相当于:
key1: some very common value
key2: some very common value
由于abric/common/configtx/tool/configtxgen/main.go
使用了架子YAML解析器,因此您不会在configtxgen
相关代码中找到对这些符号的任何引用。我建议阅读更多有关YAML文件格式的信息。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句