mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Merge pull request #14888 from bugficks/8570-mysql-ssl-datasource
MySQL SSL CA in datasource connector
This commit is contained in:
@@ -32,6 +32,18 @@ func newMysqlQueryEndpoint(datasource *models.DataSource) (tsdb.TsdbQueryEndpoin
|
||||
datasource.Url,
|
||||
datasource.Database,
|
||||
)
|
||||
|
||||
tlsConfig, err := datasource.GetTLSConfig()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if tlsConfig.RootCAs != nil || len(tlsConfig.Certificates) > 0 {
|
||||
tlsConfigString := fmt.Sprintf("ds%d", datasource.Id)
|
||||
mysql.RegisterTLSConfig(tlsConfigString, tlsConfig)
|
||||
cnnstr += "&tls=" + tlsConfigString
|
||||
}
|
||||
|
||||
logger.Debug("getEngine", "connection", cnnstr)
|
||||
|
||||
config := tsdb.SqlQueryEndpointConfiguration{
|
||||
|
||||
Reference in New Issue
Block a user