diff --git a/pkg/plugin/settings.go b/pkg/plugin/settings.go index d17bbc3..dfe5edf 100644 --- a/pkg/plugin/settings.go +++ b/pkg/plugin/settings.go @@ -49,7 +49,7 @@ func (settings *Settings) isValid() (err error) { if settings.Port <= 0 { return ErrorMessageInvalidPort } - if len(settings.TlsMode) == 0 { + if len(settings.Username) == 0 { return ErrorMessageInvalidUserName } if len(settings.Password) == 0 { diff --git a/pkg/plugin/settings_test.go b/pkg/plugin/settings_test.go index c3ef8da..384c947 100644 --- a/pkg/plugin/settings_test.go +++ b/pkg/plugin/settings_test.go @@ -133,13 +133,15 @@ func TestLoadSettings(t *testing.T) { name: "should converting string values to the correct type", args: args{ config: backend.DataSourceInstanceSettings{ - JSONData: []byte(`{"server": "test", "port": "1234", "timeout": "15", "queryTimeout": "25", "maxOpenConnections": 10, "maxIdleConnections": 5, "maxConnectionLifetime": 3600 }`), - DecryptedSecureJSONData: map[string]string{}, + JSONData: []byte(`{"server": "test", "username": "u", "port": "1234", "timeout": "15", "queryTimeout": "25", "maxOpenConnections": 10, "maxIdleConnections": 5, "maxConnectionLifetime": 3600 }`), + DecryptedSecureJSONData: map[string]string{"password": "p"}, }, }, wantSettings: Settings{ Server: "test", Port: 1234, + Username: "u", + Password: "p", Timeout: "15", QueryTimeout: "25", MaxOpenConnections: 10,