File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -638,7 +638,7 @@ func (c *configSection) IsSet(key string) bool {
638638 keysMutex .Lock ()
639639 defer keysMutex .Unlock ()
640640
641- return viper .IsSet (key )
641+ return viper .IsSet (c . prefixKey ( key ) )
642642}
643643
644644// SetupLogging initializes logging
Original file line number Diff line number Diff line change @@ -19,13 +19,14 @@ package config
1919import (
2020 "context"
2121 "fmt"
22- "github.com/stretchr/testify/require"
2322 "os"
2423 "path"
2524 "strings"
2625 "testing"
2726 "time"
2827
28+ "github.com/stretchr/testify/require"
29+
2930 "github.com/hyperledger/firefly-common/pkg/fftypes"
3031 "github.com/hyperledger/firefly-common/pkg/i18n"
3132 "github.com/sirupsen/logrus"
@@ -86,10 +87,18 @@ func TestDefaults(t *testing.T) {
8687
8788func TestValueSet (t * testing.T ) {
8889 RootConfigReset ()
90+
8991 // keys with default values are not set
92+ AddRootKey ("key1" )
9093 assert .False (t , IsSet ("key1" ))
9194 Set ("key1" , "updatedvalue" )
9295 assert .True (t , IsSet ("key1" ))
96+
97+ section := RootSection ("child" )
98+ section .AddKnownKey ("key1" )
99+ assert .False (t , section .IsSet ("key1" ))
100+ section .Set ("key1" , "updatedvalue" )
101+ assert .True (t , section .IsSet ("key1" ))
93102}
94103
95104func TestSpecificConfigFileOk (t * testing.T ) {
You can’t perform that action at this time.
0 commit comments