Browse Source

use unique datasource id when registering mysql tls config

Marcus Efraimsson 6 years ago
parent
commit
1bc2a0af70
1 changed files with 3 additions and 2 deletions
  1. 3 2
      pkg/tsdb/mysql/mysql.go

+ 3 - 2
pkg/tsdb/mysql/mysql.go

@@ -39,8 +39,9 @@ func newMysqlQueryEndpoint(datasource *models.DataSource) (tsdb.TsdbQueryEndpoin
 	}
 
 	if tlsConfig.RootCAs != nil || len(tlsConfig.Certificates) > 0 {
-		mysql.RegisterTLSConfig(datasource.Name, tlsConfig)
-		cnnstr += "&tls=" + datasource.Name
+		tlsConfigString := fmt.Sprintf("ds%d", datasource.Id)
+		mysql.RegisterTLSConfig(tlsConfigString, tlsConfig)
+		cnnstr += "&tls=" + tlsConfigString
 	}
 
 	logger.Debug("getEngine", "connection", cnnstr)