@@ -19,18 +19,22 @@ package configtx
19
19
import (
20
20
"github.com/hyperledger/fabric/common/cauthdsl"
21
21
"github.com/hyperledger/fabric/common/configtx/api"
22
- "github.com/hyperledger/fabric/common/configtx/handlers/channel"
22
+ configtxapplication "github.com/hyperledger/fabric/common/configtx/handlers/application"
23
+ configtxchannel "github.com/hyperledger/fabric/common/configtx/handlers/channel"
23
24
configtxmsp "github.com/hyperledger/fabric/common/configtx/handlers/msp"
25
+ configtxorderer "github.com/hyperledger/fabric/common/configtx/handlers/orderer"
24
26
"github.com/hyperledger/fabric/common/policies"
25
27
"github.com/hyperledger/fabric/msp"
26
28
cb "github.com/hyperledger/fabric/protos/common"
27
29
)
28
30
29
31
type resources struct {
30
- handlers map [cb.ConfigItem_ConfigType ]api.Handler
31
- policyManager policies.Manager
32
- channelConfig api.ChannelConfig
33
- mspConfigHandler * configtxmsp.MSPConfigHandler
32
+ handlers map [cb.ConfigItem_ConfigType ]api.Handler
33
+ policyManager policies.Manager
34
+ channelConfig api.ChannelConfig
35
+ ordererConfig api.OrdererConfig
36
+ applicationConfig api.ApplicationConfig
37
+ mspConfigHandler * configtxmsp.MSPConfigHandler
34
38
}
35
39
36
40
// PolicyManager returns the policies.Manager for the chain
@@ -43,6 +47,16 @@ func (r *resources) ChannelConfig() api.ChannelConfig {
43
47
return r .channelConfig
44
48
}
45
49
50
+ // OrdererConfig returns the api.OrdererConfig for the chain
51
+ func (r * resources ) OrdererConfig () api.OrdererConfig {
52
+ return r .ordererConfig
53
+ }
54
+
55
+ // ApplicationConfig returns the api.ApplicationConfig for the chain
56
+ func (r * resources ) ApplicationConfig () api.ApplicationConfig {
57
+ return r .applicationConfig
58
+ }
59
+
46
60
// MSPManager returns the msp.MSPManager for the chain
47
61
func (r * resources ) MSPManager () msp.MSPManager {
48
62
return r .mspConfigHandler
@@ -70,14 +84,20 @@ func NewInitializer() api.Initializer {
70
84
}
71
85
72
86
policyManager := policies .NewManagerImpl (policyProviderMap )
73
- channelConfig := channel .NewSharedConfigImpl ()
87
+ channelConfig := configtxchannel .NewSharedConfigImpl ()
88
+ ordererConfig := configtxorderer .NewManagerImpl ()
89
+ applicationConfig := configtxapplication .NewSharedConfigImpl ()
74
90
handlers := make (map [cb.ConfigItem_ConfigType ]api.Handler )
75
91
76
92
for ctype := range cb .ConfigItem_ConfigType_name {
77
93
rtype := cb .ConfigItem_ConfigType (ctype )
78
94
switch rtype {
79
95
case cb .ConfigItem_CHAIN :
80
96
handlers [rtype ] = channelConfig
97
+ case cb .ConfigItem_ORDERER :
98
+ handlers [rtype ] = ordererConfig
99
+ case cb .ConfigItem_PEER :
100
+ handlers [rtype ] = applicationConfig
81
101
case cb .ConfigItem_POLICY :
82
102
handlers [rtype ] = policyManager
83
103
case cb .ConfigItem_MSP :
@@ -88,9 +108,11 @@ func NewInitializer() api.Initializer {
88
108
}
89
109
90
110
return & resources {
91
- handlers : handlers ,
92
- policyManager : policyManager ,
93
- channelConfig : channelConfig ,
94
- mspConfigHandler : mspConfigHandler ,
111
+ handlers : handlers ,
112
+ policyManager : policyManager ,
113
+ channelConfig : channelConfig ,
114
+ ordererConfig : ordererConfig ,
115
+ applicationConfig : applicationConfig ,
116
+ mspConfigHandler : mspConfigHandler ,
95
117
}
96
118
}
0 commit comments