Skip to content

Commit

Permalink
Allow plugin config to be omitted
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
  • Loading branch information
awrichar committed Jun 24, 2022
1 parent 04aec20 commit 1322d87
Showing 1 changed file with 45 additions and 36 deletions.
81 changes: 45 additions & 36 deletions internal/namespace/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -375,15 +375,17 @@ func (nm *namespaceManager) getDatabasePlugins(ctx context.Context) (plugins map
// check for deprecated config
if len(plugins) == 0 {
pluginType := deprecatedDatabaseConfig.GetString(coreconfig.PluginConfigType)
plugin, err := difactory.GetPlugin(ctx, deprecatedDatabaseConfig.GetString(coreconfig.PluginConfigType))
if err != nil {
return nil, err
}
log.L(ctx).Warnf("Your database config uses a deprecated configuration structure - the database configuration has been moved under the 'plugins' section")
name := "database_0"
plugins[name] = databasePlugin{
config: deprecatedDatabaseConfig.SubSection(pluginType),
plugin: plugin,
if pluginType != "" {
plugin, err := difactory.GetPlugin(ctx, deprecatedDatabaseConfig.GetString(coreconfig.PluginConfigType))
if err != nil {
return nil, err
}
log.L(ctx).Warnf("Your database config uses a deprecated configuration structure - the database configuration has been moved under the 'plugins' section")
name := "database_0"
plugins[name] = databasePlugin{
config: deprecatedDatabaseConfig.SubSection(pluginType),
plugin: plugin,
}
}
}

Expand Down Expand Up @@ -431,17 +433,20 @@ func (nm *namespaceManager) getDataExchangePlugins(ctx context.Context) (plugins
}
}

// check deprecated config
if len(plugins) == 0 {
pluginType := deprecatedDataexchangeConfig.GetString(coreconfig.PluginConfigType)
plugin, err := dxfactory.GetPlugin(ctx, pluginType)
if err != nil {
return nil, err
}
log.L(ctx).Warnf("Your data exchange config uses a deprecated configuration structure - the data exchange configuration has been moved under the 'plugins' section")
name := "dataexchange_0"
plugins[name] = dataExchangePlugin{
config: deprecatedDataexchangeConfig.SubSection(pluginType),
plugin: plugin,
if pluginType != "" {
plugin, err := dxfactory.GetPlugin(ctx, pluginType)
if err != nil {
return nil, err
}
log.L(ctx).Warnf("Your data exchange config uses a deprecated configuration structure - the data exchange configuration has been moved under the 'plugins' section")
name := "dataexchange_0"
plugins[name] = dataExchangePlugin{
config: deprecatedDataexchangeConfig.SubSection(pluginType),
plugin: plugin,
}
}
}

Expand Down Expand Up @@ -496,15 +501,17 @@ func (nm *namespaceManager) getBlockchainPlugins(ctx context.Context) (plugins m
// check deprecated config
if len(plugins) == 0 {
pluginType := deprecatedBlockchainConfig.GetString(coreconfig.PluginConfigType)
plugin, err := bifactory.GetPlugin(ctx, pluginType)
if err != nil {
return nil, err
}
log.L(ctx).Warnf("Your blockchain config uses a deprecated configuration structure - the blockchain configuration has been moved under the 'plugins' section")
name := "blockchain_0"
plugins[name] = blockchainPlugin{
config: deprecatedBlockchainConfig.SubSection(pluginType),
plugin: plugin,
if pluginType != "" {
plugin, err := bifactory.GetPlugin(ctx, pluginType)
if err != nil {
return nil, err
}
log.L(ctx).Warnf("Your blockchain config uses a deprecated configuration structure - the blockchain configuration has been moved under the 'plugins' section")
name := "blockchain_0"
plugins[name] = blockchainPlugin{
config: deprecatedBlockchainConfig.SubSection(pluginType),
plugin: plugin,
}
}
}

Expand Down Expand Up @@ -535,15 +542,17 @@ func (nm *namespaceManager) getSharedStoragePlugins(ctx context.Context) (plugin
// check deprecated config
if len(plugins) == 0 {
pluginType := deprecatedSharedStorageConfig.GetString(coreconfig.PluginConfigType)
plugin, err := ssfactory.GetPlugin(ctx, pluginType)
if err != nil {
return nil, err
}
log.L(ctx).Warnf("Your shared storage config uses a deprecated configuration structure - the shared storage configuration has been moved under the 'plugins' section")
name := "sharedstorage_0"
plugins[name] = sharedStoragePlugin{
config: deprecatedSharedStorageConfig.SubSection(pluginType),
plugin: plugin,
if pluginType != "" {
plugin, err := ssfactory.GetPlugin(ctx, pluginType)
if err != nil {
return nil, err
}
log.L(ctx).Warnf("Your shared storage config uses a deprecated configuration structure - the shared storage configuration has been moved under the 'plugins' section")
name := "sharedstorage_0"
plugins[name] = sharedStoragePlugin{
config: deprecatedSharedStorageConfig.SubSection(pluginType),
plugin: plugin,
}
}
}

Expand Down

0 comments on commit 1322d87

Please sign in to comment.