Skip to content

Commit

Permalink
ConfigProvider exposes interface
Browse files Browse the repository at this point in the history
Signed-off-by: Alexandros Filios <[email protected]>
  • Loading branch information
alexandrosfilios committed Nov 13, 2024
1 parent 2b23679 commit 82cce09
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 3 deletions.
1 change: 0 additions & 1 deletion platform/fabric/core/generic/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ func (c *channelConfigProvider) GetChannelConfig(network, channel string) (drive
return nil, err
}

//lint:ignore SA4023 Config can be missing
if channelConfig := conf.Channel(channel); channelConfig != nil {
return channelConfig, nil
}
Expand Down
13 changes: 11 additions & 2 deletions platform/fabric/core/generic/driver/config/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

"github.com/hyperledger-labs/fabric-smart-client/platform/fabric/core"
"github.com/hyperledger-labs/fabric-smart-client/platform/fabric/core/generic/config"
driver2 "github.com/hyperledger-labs/fabric-smart-client/platform/fabric/driver"
"github.com/hyperledger-labs/fabric-smart-client/platform/view/driver"
)

Expand All @@ -19,8 +20,16 @@ type provider struct {
defaultName string
}

type ConfigService interface {
driver2.ConfigService
Resolvers() ([]config.Resolver, error)
MSPCacheSize() int
DefaultMSP() string
MSPs() ([]config.MSP, error)
}

type Provider interface {
GetConfig(network string) (*config.Service, error)
GetConfig(network string) (ConfigService, error)
}

func NewCore(config driver.ConfigService) (*core.Config, error) {
Expand All @@ -38,6 +47,6 @@ func NewProvider(config driver.ConfigService) (Provider, error) {
}, nil
}

func (p *provider) GetConfig(network string) (*config.Service, error) {
func (p *provider) GetConfig(network string) (ConfigService, error) {
return config.NewService(p.configService, network, p.defaultName == network)
}
65 changes: 65 additions & 0 deletions platform/fabric/core/generic/msp/driver/mock/config_provider.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions platform/fabric/driver/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,25 @@ type ConfigService interface {
NewDefaultChannelConfig(name string) ChannelConfig
TLSEnabled() bool
}

type Resolver interface {
// Name of the resolver
Name() string
// Domain is option
Domain() string
// Identity specifies an MSP Identity
Identity() MSP
// Addresses where to reach this identity
Addresses() map[string]string
// Aliases is a list of alias for this resolver
Aliases() []string
}

type MSP interface {
ID() string
MSPType() string
MSPID() string
Path() string
CacheSize() int
Opts() map[interface{}]interface{}
}

0 comments on commit 82cce09

Please sign in to comment.