github.com/suchongming/fabric@v2.1.1+incompatible/integration/nwo/configtx_template.go (about) 1 /* 2 Copyright IBM Corp. All Rights Reserved. 3 4 SPDX-License-Identifier: Apache-2.0 5 */ 6 7 package nwo 8 9 const DefaultConfigTxTemplate = `--- 10 {{ with $w := . -}} 11 Organizations:{{ range .PeerOrgs }} 12 - &{{ .MSPID }} 13 Name: {{ .Name }} 14 ID: {{ .MSPID }} 15 MSPDir: {{ $w.PeerOrgMSPDir . }} 16 Policies: 17 {{- if .EnableNodeOUs }} 18 Readers: 19 Type: Signature 20 Rule: OR('{{.MSPID}}.admin', '{{.MSPID}}.peer', '{{.MSPID}}.client') 21 Writers: 22 Type: Signature 23 Rule: OR('{{.MSPID}}.admin', '{{.MSPID}}.client') 24 Endorsement: 25 Type: Signature 26 Rule: OR('{{.MSPID}}.peer') 27 Admins: 28 Type: Signature 29 Rule: OR('{{.MSPID}}.admin') 30 {{- else }} 31 Readers: 32 Type: Signature 33 Rule: OR('{{.MSPID}}.member') 34 Writers: 35 Type: Signature 36 Rule: OR('{{.MSPID}}.member') 37 Endorsement: 38 Type: Signature 39 Rule: OR('{{.MSPID}}.member') 40 Admins: 41 Type: Signature 42 Rule: OR('{{.MSPID}}.admin') 43 {{- end }} 44 AnchorPeers:{{ range $w.AnchorsInOrg .Name }} 45 - Host: 127.0.0.1 46 Port: {{ $w.PeerPort . "Listen" }} 47 {{- end }} 48 {{- end }} 49 {{- range .IdemixOrgs }} 50 - &{{ .MSPID }} 51 Name: {{ .Name }} 52 ID: {{ .MSPID }} 53 MSPDir: {{ $w.IdemixOrgMSPDir . }} 54 MSPType: idemix 55 Policies: 56 {{- if .EnableNodeOUs }} 57 Readers: 58 Type: Signature 59 Rule: OR('{{.MSPID}}.admin', '{{.MSPID}}.peer', '{{.MSPID}}.client') 60 Writers: 61 Type: Signature 62 Rule: OR('{{.MSPID}}.admin', '{{.MSPID}}.client') 63 Endorsement: 64 Type: Signature 65 Rule: OR('{{.MSPID}}.peer') 66 Admins: 67 Type: Signature 68 Rule: OR('{{.MSPID}}.admin') 69 {{- else }} 70 Readers: 71 Type: Signature 72 Rule: OR('{{.MSPID}}.member') 73 Writers: 74 Type: Signature 75 Rule: OR('{{.MSPID}}.member') 76 Endorsement: 77 Type: Signature 78 Rule: OR('{{.MSPID}}.member') 79 Admins: 80 Type: Signature 81 Rule: OR('{{.MSPID}}.admin') 82 {{- end }} 83 {{ end }} 84 {{- range .OrdererOrgs }} 85 - &{{ .MSPID }} 86 Name: {{ .Name }} 87 ID: {{ .MSPID }} 88 MSPDir: {{ $w.OrdererOrgMSPDir . }} 89 Policies: 90 {{- if .EnableNodeOUs }} 91 Readers: 92 Type: Signature 93 Rule: OR('{{.MSPID}}.admin', '{{.MSPID}}.orderer', '{{.MSPID}}.client') 94 Writers: 95 Type: Signature 96 Rule: OR('{{.MSPID}}.admin', '{{.MSPID}}.orderer', '{{.MSPID}}.client') 97 Admins: 98 Type: Signature 99 Rule: OR('{{.MSPID}}.admin') 100 {{- else }} 101 Readers: 102 Type: Signature 103 Rule: OR('{{.MSPID}}.member') 104 Writers: 105 Type: Signature 106 Rule: OR('{{.MSPID}}.member') 107 Admins: 108 Type: Signature 109 Rule: OR('{{.MSPID}}.admin') 110 {{- end }} 111 OrdererEndpoints:{{ range $w.OrderersInOrg .Name }} 112 - 127.0.0.1:{{ $w.OrdererPort . "Listen" }} 113 {{- end }} 114 {{ end }} 115 116 Channel: &ChannelDefaults 117 Capabilities: 118 V2_0: true 119 Policies: &DefaultPolicies 120 Readers: 121 Type: ImplicitMeta 122 Rule: ANY Readers 123 Writers: 124 Type: ImplicitMeta 125 Rule: ANY Writers 126 Admins: 127 Type: ImplicitMeta 128 Rule: MAJORITY Admins 129 130 Profiles:{{ range .Profiles }} 131 {{ .Name }}: 132 {{- if .ChannelCapabilities}} 133 Capabilities:{{ range .ChannelCapabilities}} 134 {{ . }}: true 135 {{- end}} 136 Policies: 137 <<: *DefaultPolicies 138 {{- else }} 139 <<: *ChannelDefaults 140 {{- end}} 141 {{- if .Orderers }} 142 Orderer: 143 OrdererType: {{ $w.Consensus.Type }} 144 Addresses:{{ range .Orderers }}{{ with $w.Orderer . }} 145 - 127.0.0.1:{{ $w.OrdererPort . "Listen" }} 146 {{- end }}{{ end }} 147 BatchTimeout: 1s 148 BatchSize: 149 MaxMessageCount: 1 150 AbsoluteMaxBytes: 98 MB 151 PreferredMaxBytes: 512 KB 152 Capabilities: 153 V2_0: true 154 {{- if eq $w.Consensus.Type "kafka" }} 155 Kafka: 156 Brokers:{{ range $w.BrokerAddresses "HostPort" }} 157 - {{ . }} 158 {{- end }} 159 {{- end }} 160 {{- if eq $w.Consensus.Type "etcdraft" }} 161 EtcdRaft: 162 Options: 163 TickInterval: 500ms 164 SnapshotIntervalSize: 1 KB 165 Consenters:{{ range .Orderers }}{{ with $w.Orderer . }} 166 - Host: 127.0.0.1 167 Port: {{ $w.OrdererPort . "Cluster" }} 168 ClientTLSCert: {{ $w.OrdererLocalCryptoDir . "tls" }}/server.crt 169 ServerTLSCert: {{ $w.OrdererLocalCryptoDir . "tls" }}/server.crt 170 {{- end }}{{- end }} 171 {{- end }} 172 Organizations:{{ range $w.OrgsForOrderers .Orderers }} 173 - *{{ .MSPID }} 174 {{- end }} 175 Policies: 176 Readers: 177 Type: ImplicitMeta 178 Rule: ANY Readers 179 Writers: 180 Type: ImplicitMeta 181 Rule: ANY Writers 182 Admins: 183 Type: ImplicitMeta 184 Rule: MAJORITY Admins 185 BlockValidation: 186 Type: ImplicitMeta 187 Rule: ANY Writers 188 {{- end }} 189 {{- if .Consortium }} 190 Consortium: {{ .Consortium }} 191 Application: 192 Capabilities: 193 {{- if .AppCapabilities }}{{ range .AppCapabilities }} 194 {{ . }}: true 195 {{- end }} 196 {{- else }} 197 V1_3: true 198 {{- end }} 199 Organizations:{{ range .Organizations }} 200 - *{{ ($w.Organization .).MSPID }} 201 {{- end}} 202 Policies: 203 Readers: 204 Type: ImplicitMeta 205 Rule: ANY Readers 206 Writers: 207 Type: ImplicitMeta 208 Rule: ANY Writers 209 Admins: 210 Type: ImplicitMeta 211 Rule: MAJORITY Admins 212 LifecycleEndorsement: 213 Type: ImplicitMeta 214 Rule: "MAJORITY Endorsement" 215 Endorsement: 216 Type: ImplicitMeta 217 Rule: "MAJORITY Endorsement" 218 {{- else }} 219 Consortiums:{{ range $w.Consortiums }} 220 {{ .Name }}: 221 Organizations:{{ range .Organizations }} 222 - *{{ ($w.Organization .).MSPID }} 223 {{- end }} 224 {{- end }} 225 {{- end }} 226 {{- end }} 227 {{ end }} 228 ` 229 230 const OrgUpdateConfigTxTemplate = `--- 231 {{ with $w := . -}} 232 Organizations:{{ range .PeerOrgs }} 233 - &{{ .MSPID }} 234 Name: {{ .Name }} 235 ID: {{ .MSPID }} 236 MSPDir: {{ $w.PeerOrgMSPDir . }} 237 Policies: 238 Readers: 239 Type: Signature 240 Rule: OR('{{.MSPID}}.admin', '{{.MSPID}}.peer', '{{.MSPID}}.client') 241 Writers: 242 Type: Signature 243 Rule: OR('{{.MSPID}}.admin', '{{.MSPID}}.client') 244 Endorsement: 245 Type: Signature 246 Rule: OR('{{.MSPID}}.peer') 247 Admins: 248 Type: Signature 249 Rule: OR('{{.MSPID}}.admin') 250 AnchorPeers:{{ range $w.AnchorsInOrg .Name }} 251 - Host: 127.0.0.1 252 Port: {{ $w.PeerPort . "Listen" }} 253 {{- end }} 254 {{- end }} 255 {{ end }} 256 `