go-sql-driver / go-sql-driver/mysql
Default to No TLS when using FormatDSN
- Dominant language
- Go
- Stars
- 15.3k
- Forks
- 2.3k
- Avg merge
- 2h 23m
- Merged PRs (30d)
- 10
Description
Hello, when I use the very convenient ``FormatDSN()`` function to initiate my DB connections:
e.g
```go
mysqlConfig := mysql.Config{}
db, err := sql.Open("mysql", mysqlConfig.FormatDSN())
```
If I don't set any TLSConfig in the `mysql.Config` structure, it is by default not setting tls=true.
So I have to explicitly set insecure skip verify to false to enable
e.g
```go
tlsConfig := &tls.Config{
InsecureSkipVerify: false,
}
_ = mysql.RegisterTLSConfig("my-tls-config", tlsConfig)
mysqlConfig := mysql.Config{
TLSConfig: "my-tls-config"
}
db, err := sql.Open("mysql", mysqlConfig.FormatDSN())
```
I was wondering if you couldn't benefit to put tls=true by default and have an additional explicit config field to disable TLS if desired. So that if I want to enable TLS but want to rely on defaults, I can.
Contributor guide
Assessment
This issue has not been assessed yet.