Skip to content

Commit c6ad1be

Browse files
authored
socks proxy: store datasource type & name (#896)
1 parent c3f4b78 commit c6ad1be

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

backend/common.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,9 @@ func (s *DataSourceInstanceSettings) ProxyOptions(clientCfg *proxy.ClientCfg) (*
252252
return nil, nil
253253
}
254254

255+
opts.DatasourceName = s.Name
256+
opts.DatasourceType = s.Type
257+
255258
opts.Auth = &proxy.AuthOptions{}
256259
opts.Timeouts = &proxy.TimeoutOptions{}
257260
if v, exists := dat["secureSocksProxyUsername"]; exists {

backend/common_test.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,9 @@ func TestProxyOptions(t *testing.T) {
300300
Auth: &proxy.AuthOptions{
301301
Username: "uid1",
302302
},
303-
Timeouts: &proxy.DefaultTimeoutOptions,
303+
Timeouts: &proxy.DefaultTimeoutOptions,
304+
DatasourceName: "ds1",
305+
DatasourceType: "example-datasource",
304306
},
305307
},
306308
{
@@ -322,7 +324,9 @@ func TestProxyOptions(t *testing.T) {
322324
Username: "username",
323325
Password: "pswd",
324326
},
325-
Timeouts: &proxy.DefaultTimeoutOptions,
327+
Timeouts: &proxy.DefaultTimeoutOptions,
328+
DatasourceName: "ds1",
329+
DatasourceType: "example-datasource",
326330
},
327331
},
328332
{
@@ -344,6 +348,8 @@ func TestProxyOptions(t *testing.T) {
344348
KeepAlive: time.Second * 15,
345349
Timeout: time.Second * 10,
346350
},
351+
DatasourceName: "ds1",
352+
DatasourceType: "example-datasource",
347353
},
348354
},
349355
{
@@ -379,6 +385,8 @@ func TestProxyOptions(t *testing.T) {
379385
ProxyAddress: "10.1.2.3",
380386
ServerName: "grafana-server",
381387
},
388+
DatasourceName: "ds1",
389+
DatasourceType: "example-datasource",
382390
},
383391
},
384392
}

0 commit comments

Comments
 (0)