Skip to content

Default to No TLS when using FormatDSN #1728

Description

@celian-garcia

Hello, when I use the very convenient FormatDSN() function to initiate my DB connections:
e.g

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

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions