Skip to content

Commit 01cc491

Browse files
christo4ferrisGerrit Code Review
authored andcommitted
Merge "[FAB-2546]Add yaml tags to structs needed for configtx"
2 parents 0c07573 + cd14e2a commit 01cc491

File tree

3 files changed

+32
-32
lines changed

3 files changed

+32
-32
lines changed

bccsp/factory/opts.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ package factory
1717

1818
// DefaultOpts offers a default implementation for Opts
1919
type FactoryOpts struct {
20-
ProviderName string `mapstructure:"default" json:"default"`
21-
SwOpts *SwOpts `mapstructure:"SW,omitempty" json:"SW,omitempty"`
22-
Pkcs11Opts *PKCS11Opts `mapstructure:"PKCS11,omitempty" json:"PKCS11,omitempty"`
20+
ProviderName string `mapstructure:"default" json:"default" yaml:"Default"`
21+
SwOpts *SwOpts `mapstructure:"SW,omitempty" json:"SW,omitempty" yaml:"SwOpts"`
22+
Pkcs11Opts *PKCS11Opts `mapstructure:"PKCS11,omitempty" json:"PKCS11,omitempty" yaml:"PKCS11"`
2323
}
2424

2525
var DefaultOpts = FactoryOpts{

bccsp/factory/swfactory.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,18 +65,18 @@ func (f *SWFactory) Get(config *FactoryOpts) (bccsp.BCCSP, error) {
6565
// SwOpts contains options for the SWFactory
6666
type SwOpts struct {
6767
// Default algorithms when not specified (Deprecated?)
68-
SecLevel int `mapstructure:"security" json:"security"`
69-
HashFamily string `mapstructure:"hash" json:"hash"`
68+
SecLevel int `mapstructure:"security" json:"security" yaml:"Security"`
69+
HashFamily string `mapstructure:"hash" json:"hash" yaml:"Hash"`
7070

7171
// Keystore Options
7272
Ephemeral bool `mapstructure:"tempkeys,omitempty" json:"tempkeys,omitempty"`
73-
FileKeystore *FileKeystoreOpts `mapstructure:"filekeystore,omitempty" json:"filekeystore,omitempty"`
73+
FileKeystore *FileKeystoreOpts `mapstructure:"filekeystore,omitempty" json:"filekeystore,omitempty" yaml:"FileKeyStore"`
7474
DummyKeystore *DummyKeystoreOpts `mapstructure:"dummykeystore,omitempty" json:"dummykeystore,omitempty"`
7575
}
7676

7777
// Pluggable Keystores, could add JKS, P12, etc..
7878
type FileKeystoreOpts struct {
79-
KeyStorePath string `mapstructure:"keystore"`
79+
KeyStorePath string `mapstructure:"keystore" yaml:"KeyStore"`
8080
}
8181

8282
type DummyKeystoreOpts struct{}

common/configtx/tool/localconfig/config.go

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -46,64 +46,64 @@ const Prefix string = "CONFIGTX"
4646

4747
// TopLevel contains the genesis structures for use by the provisional bootstrapper
4848
type TopLevel struct {
49-
Profiles map[string]*Profile
50-
Organizations []*Organization
51-
Application *Application
52-
Orderer *Orderer
49+
Profiles map[string]*Profile `yaml:"Profiles"`
50+
Organizations []*Organization `yaml:"Organizations"`
51+
Application *Application `yaml:"Application"`
52+
Orderer *Orderer `yaml:"Orderer"`
5353
}
5454

5555
// TopLevel contains the genesis structures for use by the provisional bootstrapper
5656
type Profile struct {
57-
Application *Application
58-
Orderer *Orderer
57+
Application *Application `yaml:"Application"`
58+
Orderer *Orderer `yaml:"Orderer"`
5959
}
6060

6161
// Application encodes the configuration needed for the config transaction
6262
type Application struct {
63-
Organizations []*Organization
63+
Organizations []*Organization `yaml:"Organizations"`
6464
}
6565

6666
type Organization struct {
67-
Name string
68-
ID string
69-
MSPDir string
70-
BCCSP *bccsp.FactoryOpts
67+
Name string `yaml:"Name"`
68+
ID string `yaml:"ID"`
69+
MSPDir string `yaml:"MSPDir"`
70+
BCCSP *bccsp.FactoryOpts `yaml:"BCCSP"`
7171

7272
// Note, the viper deserialization does not seem to care for
7373
// embedding of types, so we use one organization structure for
7474
// both orderers and applications
75-
AnchorPeers []*AnchorPeer
75+
AnchorPeers []*AnchorPeer `yaml:"AnchorPeers"`
7676
}
7777

7878
type AnchorPeer struct {
79-
Host string
80-
Port int
79+
Host string `yaml:"Host"`
80+
Port int `yaml:"Port"`
8181
}
8282

8383
type ApplicationOrganization struct {
84-
Organization
84+
Organization `yaml:"Organization"`
8585
}
8686

8787
// Orderer contains config which is used for orderer genesis by the provisional bootstrapper
8888
type Orderer struct {
89-
OrdererType string
90-
Addresses []string
91-
BatchTimeout time.Duration
92-
BatchSize BatchSize
93-
Kafka Kafka
94-
Organizations []*Organization
89+
OrdererType string `yaml:"OrdererType"`
90+
Addresses []string `yaml:"Addresses"`
91+
BatchTimeout time.Duration `yaml:"BatchTimeout"`
92+
BatchSize BatchSize `yaml:"BatchSize"`
93+
Kafka Kafka `yaml:"Kafka"`
94+
Organizations []*Organization `yaml:"Organizations"`
9595
}
9696

9797
// BatchSize contains configuration affecting the size of batches
9898
type BatchSize struct {
99-
MaxMessageCount uint32
100-
AbsoluteMaxBytes uint32
101-
PreferredMaxBytes uint32
99+
MaxMessageCount uint32 `yaml:"MaxMessageSize"`
100+
AbsoluteMaxBytes uint32 `yaml:"AbsoluteMaxBytes"`
101+
PreferredMaxBytes uint32 `yaml:"PreferredMaxBytes"`
102102
}
103103

104104
// Kafka contains config for the Kafka orderer
105105
type Kafka struct {
106-
Brokers []string
106+
Brokers []string `yaml:"Brokers"`
107107
}
108108

109109
var genesisDefaults = TopLevel{

0 commit comments

Comments
 (0)