File tree Expand file tree Collapse file tree 4 files changed +24
-2
lines changed Expand file tree Collapse file tree 4 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -336,7 +336,7 @@ nav_order: 2
336336
337337| Key| Description| Type| Default Value|
338338| ---| -----------| ----| -------------|
339- |type|The Data Exchange plugin to use|` string ` |` ffdx `
339+ |type|The Data Exchange plugin to use|` string ` |` <nil> `
340340
341341## dataexchange.ffdx
342342
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ func InitConfig(config config.ArraySection) {
4444}
4545
4646func InitConfigDeprecated (config config.Section ) {
47- config .AddKnownKey (coreconfig .PluginConfigType , NewFFDXPluginName )
47+ config .AddKnownKey (coreconfig .PluginConfigType )
4848 for name , plugin := range pluginsByName {
4949 plugin ().InitConfig (config .SubSection (name ))
5050 }
Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ import (
4747 "github.com/hyperledger/firefly/pkg/identity"
4848 "github.com/hyperledger/firefly/pkg/sharedstorage"
4949 "github.com/hyperledger/firefly/pkg/tokens"
50+ "github.com/spf13/viper"
5051)
5152
5253var (
@@ -436,6 +437,10 @@ func (nm *namespaceManager) getDataExchangePlugins(ctx context.Context) (plugins
436437 // check deprecated config
437438 if len (plugins ) == 0 {
438439 pluginType := deprecatedDataexchangeConfig .GetString (coreconfig .PluginConfigType )
440+ if pluginType == "" && viper .Get ("dataexchange" ) != nil {
441+ // very old config allowed omitting an explicit "type" for data exchange
442+ pluginType = dxfactory .NewFFDXPluginName
443+ }
439444 if pluginType != "" {
440445 plugin , err := dxfactory .GetPlugin (ctx , pluginType )
441446 if err != nil {
Original file line number Diff line number Diff line change @@ -563,6 +563,23 @@ func TestDeprecatedDataExchangePluginBadType(t *testing.T) {
563563 assert .Regexp (t , "FF10213.*wrong" , err )
564564}
565565
566+ func TestDeprecatedDataExchangePluginDefaultType (t * testing.T ) {
567+ nm := newTestNamespaceManager (true )
568+ defer nm .cleanup (t )
569+ dxfactory .InitConfigDeprecated (deprecatedDataexchangeConfig )
570+
571+ viper .SetConfigType ("yaml" )
572+ err := viper .ReadConfig (strings .NewReader (`
573+ dataexchange:
574+ ffdx:
575+ url: http://dx
576+ ` ))
577+ assert .NoError (t , err )
578+
579+ _ , err = nm .getDataExchangePlugins (context .Background ())
580+ assert .NoError (t , err )
581+ }
582+
566583func TestDataExchangePlugin (t * testing.T ) {
567584 nm := newTestNamespaceManager (true )
568585 defer nm .cleanup (t )
You can’t perform that action at this time.
0 commit comments