Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: update

d-bytebase5f86ca3f6773
diff --git a/backend/api/v1/instance_service.go b/backend/api/v1/instance_service.go
index 7e9aef565f..d50a3e1aae 100644
--- a/backend/api/v1/instance_service.go
+++ b/backend/api/v1/instance_service.go
@@ -871,6 +871,9 @@ func (s *InstanceService) UpdateDataSource(ctx context.Context, request *v1pb.Up
case "warehouse_id":
dataSource.WarehouseID = request.DataSource.WarehouseId
patch.WarehouseID = &request.DataSource.WarehouseId
+ case "use_ssl":
+ dataSource.UseSSL = request.DataSource.UseSsl
+ patch.UseSSL = &request.DataSource.UseSsl
default:
return nil, status.Errorf(codes.InvalidArgument, `unsupport update_mask "%s"`, path)
}
@@ -1180,6 +1183,7 @@ func convertToV1DataSources(dataSources []*store.DataSourceMessage) ([]*v1pb.Dat
DirectConnection: ds.DirectConnection,
Region: ds.Region,
WarehouseId: ds.WarehouseID,
+ UseSsl: ds.UseSSL,
})
}
diff --git a/backend/component/dbfactory/dbfactory.go b/backend/component/dbfactory/dbfactory.go
index 17e5d5d5db..aeaf052c8c 100644
--- a/backend/component/dbfactory/dbfactory.go
+++ b/backend/component/dbfactory/dbfactory.go
@@ -206,6 +206,7 @@ func (d *DBFactory) GetDataSourceDriver(ctx context.Context, instance *store.Ins
Username: dataSource.Username,
Password: password,
TLSConfig: db.TLSConfig{
+ UseSSL: dataSource.UseSSL,
SslCA: sslCA,
SslCert: sslCert,
SslKey: sslKey,
diff --git a/backend/plugin/db/ssl.go b/backend/plugin/db/ssl.go
index 4d7824395a..3d4b083885 100644
--- a/backend/plugin/db/ssl.go
+++ b/backend/plugin/db/ssl.go
@@ -9,6 +9,7 @@ import (
// TLSConfig is the configuration for SSL connection.
type TLSConfig struct {
+ UseSSL bool
SslCA string
SslCert string
SslKey string
diff --git a/backend/store/data_source.go b/backend/store/data_source.go
index 114fe4f92b..986da77bcb 100644
--- a/backend/store/data_source.go
+++ b/backend/store/data_source.go
@@ -53,6 +53,7 @@ type DataSourceMessage struct {
Region string
AccountID string
WarehouseID string
+ UseSSL bool
}
// Copy returns a copy of the data source message.
@@ -86,6 +87,7 @@ func (m *DataSourceMessage) Copy() *DataSourceMessage {
ReplicaSet: m.ReplicaSet,
DirectConnection: m.DirectConnection,
Region: m.Region,
+ UseSSL: m.UseSSL,
}
}
@@ -130,6 +132,7 @@ type UpdateDataSourceMessage struct {
Region *string
AccountID *string
WarehouseID *string
+ UseSSL *bool
}
func (*Store) listDataSourceV2(ctx context.Context, tx *Tx, instanceID string) ([]*DataSourceMessage, error) {
@@ -199,6 +202,7 @@ func (*Store) listDataSourceV2(ctx context.Context, tx *Tx, instanceID string) (
dataSourceMessage.Region = dataSourceOptions.Region
dataSourceMessage.AccountID = dataSourceOptions.AccountId
dataSourceMessage.WarehouseID = dataSourceOptions.WarehouseId
+ dataSourceMessage.UseSSL = dataSourceOptions.UseSsl
dataSourceMessages = append(dataSourceMessages, &dataSourceMessage)
}
if err := rows.Err(); err != nil {
@@ -369,6 +373,9 @@ func (s *Store) UpdateDataSourceV2(ctx context.Context, patch *UpdateDataSourceM
if v := patch.WarehouseID; v != nil {
optionSet, args = append(optionSet, fmt.Sprintf("jsonb_build_object('warehouseId', $%d::TEXT)", len(args)+1)), append(args, *v)
}
+ if v := patch.UseSSL; v != nil {
+ optionSet, args = append(optionSet, fmt.Sprintf("jsonb_build_object('useSsl', $%d::TEXT)", len(args)+1)), append(args, *v)
+ }
if len(optionSet) != 0 {
set = append(set, fmt.Sprintf(`options = options || %s`, strings.Join(optionSet, "||")))
}
@@ -427,6 +434,7 @@ func (*Store) addDataSourceToInstanceImplV2(ctx context.Context, tx *Tx, instanc
Region: dataSource.Region,
WarehouseId: dataSource.WarehouseID,
AccountId: dataSource.AccountID,
+ UseSsl: dataSource.UseSSL,
}
protoBytes, err := protojson.Marshal(&dataSourceOptions)
if err != nil {