github.com/yous1230/fabric@v2.0.0-beta.0.20191224111736-74345bee6ac2+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 Readers: 18 Type: Signature 19 Rule: OR('{{.MSPID}}.admin', '{{.MSPID}}.peer', '{{.MSPID}}.client') 20 Writers: 21 Type: Signature 22 Rule: OR('{{.MSPID}}.admin', '{{.MSPID}}.client') 23 Endorsement: 24 Type: Signature 25 Rule: OR('{{.MSPID}}.peer') 26 Admins: 27 Type: Signature 28 Rule: OR('{{.MSPID}}.admin') 29 AnchorPeers:{{ range $w.AnchorsInOrg .Name }} 30 - Host: 127.0.0.1 31 Port: {{ $w.PeerPort . "Listen" }} 32 {{- end }} 33 {{- end }} 34 {{- range .IdemixOrgs }} 35 - &{{ .MSPID }} 36 Name: {{ .Name }} 37 ID: {{ .MSPID }} 38 MSPDir: {{ $w.IdemixOrgMSPDir . }} 39 MSPType: idemix 40 Policies: 41 Readers: 42 Type: Signature 43 Rule: OR('{{.MSPID}}.admin', '{{.MSPID}}.peer', '{{.MSPID}}.client') 44 Writers: 45 Type: Signature 46 Rule: OR('{{.MSPID}}.admin', '{{.MSPID}}.client') 47 Endorsement: 48 Type: Signature 49 Rule: OR('{{.MSPID}}.peer') 50 Admins: 51 Type: Signature 52 Rule: OR('{{.MSPID}}.admin') 53 {{ end }} 54 {{- range .OrdererOrgs }} 55 - &{{ .MSPID }} 56 Name: {{ .Name }} 57 ID: {{ .MSPID }} 58 MSPDir: {{ $w.OrdererOrgMSPDir . }} 59 Policies: 60 Readers: 61 Type: Signature 62 Rule: OR('{{.MSPID}}.member') 63 Writers: 64 Type: Signature 65 Rule: OR('{{.MSPID}}.member') 66 Admins: 67 Type: Signature 68 Rule: OR('{{.MSPID}}.admin') 69 OrdererEndpoints:{{ range $w.OrderersInOrg .Name }} 70 - 127.0.0.1:{{ $w.OrdererPort . "Listen" }} 71 {{- end }} 72 {{ end }} 73 74 Channel: &ChannelDefaults 75 Capabilities: 76 V2_0: true 77 Policies: &DefaultPolicies 78 Readers: 79 Type: ImplicitMeta 80 Rule: ANY Readers 81 Writers: 82 Type: ImplicitMeta 83 Rule: ANY Writers 84 Admins: 85 Type: ImplicitMeta 86 Rule: MAJORITY Admins 87 88 Profiles:{{ range .Profiles }} 89 {{ .Name }}: 90 {{- if .ChannelCapabilities}} 91 Capabilities:{{ range .ChannelCapabilities}} 92 {{ . }}: true 93 {{- end}} 94 Policies: 95 <<: *DefaultPolicies 96 {{- else }} 97 <<: *ChannelDefaults 98 {{- end}} 99 {{- if .Orderers }} 100 Orderer: 101 OrdererType: {{ $w.Consensus.Type }} 102 Addresses:{{ range .Orderers }}{{ with $w.Orderer . }} 103 - 127.0.0.1:{{ $w.OrdererPort . "Listen" }} 104 {{- end }}{{ end }} 105 BatchTimeout: 1s 106 BatchSize: 107 MaxMessageCount: 1 108 AbsoluteMaxBytes: 98 MB 109 PreferredMaxBytes: 512 KB 110 Capabilities: 111 V2_0: true 112 {{- if eq $w.Consensus.Type "kafka" }} 113 Kafka: 114 Brokers:{{ range $w.BrokerAddresses "HostPort" }} 115 - {{ . }} 116 {{- end }} 117 {{- end }} 118 {{- if eq $w.Consensus.Type "etcdraft" }} 119 EtcdRaft: 120 Options: 121 TickInterval: 500ms 122 SnapshotIntervalSize: 1 KB 123 Consenters:{{ range .Orderers }}{{ with $w.Orderer . }} 124 - Host: 127.0.0.1 125 Port: {{ $w.OrdererPort . "Cluster" }} 126 ClientTLSCert: {{ $w.OrdererLocalCryptoDir . "tls" }}/server.crt 127 ServerTLSCert: {{ $w.OrdererLocalCryptoDir . "tls" }}/server.crt 128 {{- end }}{{- end }} 129 {{- end }} 130 Organizations:{{ range $w.OrgsForOrderers .Orderers }} 131 - *{{ .MSPID }} 132 {{- end }} 133 Policies: 134 Readers: 135 Type: ImplicitMeta 136 Rule: ANY Readers 137 Writers: 138 Type: ImplicitMeta 139 Rule: ANY Writers 140 Admins: 141 Type: ImplicitMeta 142 Rule: MAJORITY Admins 143 BlockValidation: 144 Type: ImplicitMeta 145 Rule: ANY Writers 146 {{- end }} 147 {{- if .Consortium }} 148 Consortium: {{ .Consortium }} 149 Application: 150 Capabilities: 151 {{- if .AppCapabilities }}{{ range .AppCapabilities }} 152 {{ . }}: true 153 {{- end }} 154 {{- else }} 155 V1_3: true 156 {{- end }} 157 Organizations:{{ range .Organizations }} 158 - *{{ ($w.Organization .).MSPID }} 159 {{- end}} 160 Policies: 161 Readers: 162 Type: ImplicitMeta 163 Rule: ANY Readers 164 Writers: 165 Type: ImplicitMeta 166 Rule: ANY Writers 167 Admins: 168 Type: ImplicitMeta 169 Rule: MAJORITY Admins 170 LifecycleEndorsement: 171 Type: ImplicitMeta 172 Rule: "MAJORITY Endorsement" 173 Endorsement: 174 Type: ImplicitMeta 175 Rule: "MAJORITY Endorsement" 176 {{- else }} 177 Consortiums:{{ range $w.Consortiums }} 178 {{ .Name }}: 179 Organizations:{{ range .Organizations }} 180 - *{{ ($w.Organization .).MSPID }} 181 {{- end }} 182 {{- end }} 183 {{- end }} 184 {{- end }} 185 {{ end }} 186 ` 187 188 const OrgUpdateConfigTxTemplate = `--- 189 {{ with $w := . -}} 190 Organizations:{{ range .PeerOrgs }} 191 - &{{ .MSPID }} 192 Name: {{ .Name }} 193 ID: {{ .MSPID }} 194 MSPDir: {{ $w.PeerOrgMSPDir . }} 195 Policies: 196 Readers: 197 Type: Signature 198 Rule: OR('{{.MSPID}}.admin', '{{.MSPID}}.peer', '{{.MSPID}}.client') 199 Writers: 200 Type: Signature 201 Rule: OR('{{.MSPID}}.admin', '{{.MSPID}}.client') 202 Endorsement: 203 Type: Signature 204 Rule: OR('{{.MSPID}}.peer') 205 Admins: 206 Type: Signature 207 Rule: OR('{{.MSPID}}.admin') 208 AnchorPeers:{{ range $w.AnchorsInOrg .Name }} 209 - Host: 127.0.0.1 210 Port: {{ $w.PeerPort . "Listen" }} 211 {{- end }} 212 {{- end }} 213 {{ end }} 214 `