Skip to content

Commit

Permalink
socks proxy: store datasource type & name (#896)
Browse files Browse the repository at this point in the history
  • Loading branch information
gabor authored Feb 12, 2024
1 parent c3f4b78 commit c6ad1be
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
3 changes: 3 additions & 0 deletions backend/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,9 @@ func (s *DataSourceInstanceSettings) ProxyOptions(clientCfg *proxy.ClientCfg) (*
return nil, nil
}

opts.DatasourceName = s.Name
opts.DatasourceType = s.Type

opts.Auth = &proxy.AuthOptions{}
opts.Timeouts = &proxy.TimeoutOptions{}
if v, exists := dat["secureSocksProxyUsername"]; exists {
Expand Down
12 changes: 10 additions & 2 deletions backend/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,9 @@ func TestProxyOptions(t *testing.T) {
Auth: &proxy.AuthOptions{
Username: "uid1",
},
Timeouts: &proxy.DefaultTimeoutOptions,
Timeouts: &proxy.DefaultTimeoutOptions,
DatasourceName: "ds1",
DatasourceType: "example-datasource",
},
},
{
Expand All @@ -322,7 +324,9 @@ func TestProxyOptions(t *testing.T) {
Username: "username",
Password: "pswd",
},
Timeouts: &proxy.DefaultTimeoutOptions,
Timeouts: &proxy.DefaultTimeoutOptions,
DatasourceName: "ds1",
DatasourceType: "example-datasource",
},
},
{
Expand All @@ -344,6 +348,8 @@ func TestProxyOptions(t *testing.T) {
KeepAlive: time.Second * 15,
Timeout: time.Second * 10,
},
DatasourceName: "ds1",
DatasourceType: "example-datasource",
},
},
{
Expand Down Expand Up @@ -379,6 +385,8 @@ func TestProxyOptions(t *testing.T) {
ProxyAddress: "10.1.2.3",
ServerName: "grafana-server",
},
DatasourceName: "ds1",
DatasourceType: "example-datasource",
},
},
}
Expand Down

0 comments on commit c6ad1be

Please sign in to comment.