Skip to content

Commit 6377367

Browse files
authored
chore: make configurator.Config public (#16624)
1 parent 3aab81f commit 6377367

File tree

1 file changed

+23
-22
lines changed

1 file changed

+23
-22
lines changed

testutil/configurator/configurator.go

+23-22
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,16 @@ var initGenesisOrder = []string{
9191
"circuit",
9292
}
9393

94-
type appConfig struct {
94+
// Config should never need to be instantiated manually and is solely used for ModuleOption.
95+
type Config struct {
9596
moduleConfigs map[string]*appv1alpha1.ModuleConfig
9697
setInitGenesis bool
9798
}
9899

99-
type ModuleOption func(config *appConfig)
100+
type ModuleOption func(config *Config)
100101

101102
func BankModule() ModuleOption {
102-
return func(config *appConfig) {
103+
return func(config *Config) {
103104
config.moduleConfigs["bank"] = &appv1alpha1.ModuleConfig{
104105
Name: "bank",
105106
Config: appconfig.WrapAny(&bankmodulev1.Module{}),
@@ -108,7 +109,7 @@ func BankModule() ModuleOption {
108109
}
109110

110111
func AuthModule() ModuleOption {
111-
return func(config *appConfig) {
112+
return func(config *Config) {
112113
config.moduleConfigs["auth"] = &appv1alpha1.ModuleConfig{
113114
Name: "auth",
114115
Config: appconfig.WrapAny(&authmodulev1.Module{
@@ -128,7 +129,7 @@ func AuthModule() ModuleOption {
128129
}
129130

130131
func ParamsModule() ModuleOption {
131-
return func(config *appConfig) {
132+
return func(config *Config) {
132133
config.moduleConfigs["params"] = &appv1alpha1.ModuleConfig{
133134
Name: "params",
134135
Config: appconfig.WrapAny(&paramsmodulev1.Module{}),
@@ -137,7 +138,7 @@ func ParamsModule() ModuleOption {
137138
}
138139

139140
func TxModule() ModuleOption {
140-
return func(config *appConfig) {
141+
return func(config *Config) {
141142
config.moduleConfigs["tx"] = &appv1alpha1.ModuleConfig{
142143
Name: "tx",
143144
Config: appconfig.WrapAny(&txconfigv1.Config{}),
@@ -146,7 +147,7 @@ func TxModule() ModuleOption {
146147
}
147148

148149
func StakingModule() ModuleOption {
149-
return func(config *appConfig) {
150+
return func(config *Config) {
150151
config.moduleConfigs["staking"] = &appv1alpha1.ModuleConfig{
151152
Name: "staking",
152153
Config: appconfig.WrapAny(&stakingmodulev1.Module{}),
@@ -155,7 +156,7 @@ func StakingModule() ModuleOption {
155156
}
156157

157158
func SlashingModule() ModuleOption {
158-
return func(config *appConfig) {
159+
return func(config *Config) {
159160
config.moduleConfigs["slashing"] = &appv1alpha1.ModuleConfig{
160161
Name: "slashing",
161162
Config: appconfig.WrapAny(&slashingmodulev1.Module{}),
@@ -164,7 +165,7 @@ func SlashingModule() ModuleOption {
164165
}
165166

166167
func GenutilModule() ModuleOption {
167-
return func(config *appConfig) {
168+
return func(config *Config) {
168169
config.moduleConfigs["genutil"] = &appv1alpha1.ModuleConfig{
169170
Name: "genutil",
170171
Config: appconfig.WrapAny(&genutilmodulev1.Module{}),
@@ -173,7 +174,7 @@ func GenutilModule() ModuleOption {
173174
}
174175

175176
func DistributionModule() ModuleOption {
176-
return func(config *appConfig) {
177+
return func(config *Config) {
177178
config.moduleConfigs["distribution"] = &appv1alpha1.ModuleConfig{
178179
Name: "distribution",
179180
Config: appconfig.WrapAny(&distrmodulev1.Module{}),
@@ -182,7 +183,7 @@ func DistributionModule() ModuleOption {
182183
}
183184

184185
func FeegrantModule() ModuleOption {
185-
return func(config *appConfig) {
186+
return func(config *Config) {
186187
config.moduleConfigs["feegrant"] = &appv1alpha1.ModuleConfig{
187188
Name: "feegrant",
188189
Config: appconfig.WrapAny(&feegrantmodulev1.Module{}),
@@ -191,7 +192,7 @@ func FeegrantModule() ModuleOption {
191192
}
192193

193194
func VestingModule() ModuleOption {
194-
return func(config *appConfig) {
195+
return func(config *Config) {
195196
config.moduleConfigs["vesting"] = &appv1alpha1.ModuleConfig{
196197
Name: "vesting",
197198
Config: appconfig.WrapAny(&vestingmodulev1.Module{}),
@@ -200,7 +201,7 @@ func VestingModule() ModuleOption {
200201
}
201202

202203
func GovModule() ModuleOption {
203-
return func(config *appConfig) {
204+
return func(config *Config) {
204205
config.moduleConfigs["gov"] = &appv1alpha1.ModuleConfig{
205206
Name: "gov",
206207
Config: appconfig.WrapAny(&govmodulev1.Module{}),
@@ -209,7 +210,7 @@ func GovModule() ModuleOption {
209210
}
210211

211212
func ConsensusModule() ModuleOption {
212-
return func(config *appConfig) {
213+
return func(config *Config) {
213214
config.moduleConfigs["consensus"] = &appv1alpha1.ModuleConfig{
214215
Name: "consensus",
215216
Config: appconfig.WrapAny(&consensusmodulev1.Module{}),
@@ -218,7 +219,7 @@ func ConsensusModule() ModuleOption {
218219
}
219220

220221
func MintModule() ModuleOption {
221-
return func(config *appConfig) {
222+
return func(config *Config) {
222223
config.moduleConfigs["mint"] = &appv1alpha1.ModuleConfig{
223224
Name: "mint",
224225
Config: appconfig.WrapAny(&mintmodulev1.Module{}),
@@ -233,7 +234,7 @@ func MintModule() ModuleOption {
233234
}
234235

235236
func EvidenceModule() ModuleOption {
236-
return func(config *appConfig) {
237+
return func(config *Config) {
237238
config.moduleConfigs["evidence"] = &appv1alpha1.ModuleConfig{
238239
Name: "evidence",
239240
Config: appconfig.WrapAny(&evidencemodulev1.Module{}),
@@ -242,7 +243,7 @@ func EvidenceModule() ModuleOption {
242243
}
243244

244245
func AuthzModule() ModuleOption {
245-
return func(config *appConfig) {
246+
return func(config *Config) {
246247
config.moduleConfigs["authz"] = &appv1alpha1.ModuleConfig{
247248
Name: "authz",
248249
Config: appconfig.WrapAny(&authzmodulev1.Module{}),
@@ -251,7 +252,7 @@ func AuthzModule() ModuleOption {
251252
}
252253

253254
func GroupModule() ModuleOption {
254-
return func(config *appConfig) {
255+
return func(config *Config) {
255256
config.moduleConfigs["group"] = &appv1alpha1.ModuleConfig{
256257
Name: "group",
257258
Config: appconfig.WrapAny(&groupmodulev1.Module{}),
@@ -260,7 +261,7 @@ func GroupModule() ModuleOption {
260261
}
261262

262263
func NFTModule() ModuleOption {
263-
return func(config *appConfig) {
264+
return func(config *Config) {
264265
config.moduleConfigs["nft"] = &appv1alpha1.ModuleConfig{
265266
Name: "nft",
266267
Config: appconfig.WrapAny(&nftmodulev1.Module{}),
@@ -269,7 +270,7 @@ func NFTModule() ModuleOption {
269270
}
270271

271272
func CircuitModule() ModuleOption {
272-
return func(config *appConfig) {
273+
return func(config *Config) {
273274
config.moduleConfigs["circuit"] = &appv1alpha1.ModuleConfig{
274275
Name: "circuit",
275276
Config: appconfig.WrapAny(&circuitmodulev1.Module{}),
@@ -278,13 +279,13 @@ func CircuitModule() ModuleOption {
278279
}
279280

280281
func OmitInitGenesis() ModuleOption {
281-
return func(config *appConfig) {
282+
return func(config *Config) {
282283
config.setInitGenesis = false
283284
}
284285
}
285286

286287
func NewAppConfig(opts ...ModuleOption) depinject.Config {
287-
cfg := &appConfig{
288+
cfg := &Config{
288289
moduleConfigs: make(map[string]*appv1alpha1.ModuleConfig),
289290
setInitGenesis: true,
290291
}

0 commit comments

Comments
 (0)