Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 13 additions & 17 deletions go/vt/dbconfigs/dbconfigs.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,27 +237,23 @@ func HasConnectionParams() bool {
// is used to initialize the per-user conn params.
func Init(defaultSocketFile string) (*DBConfigs, error) {
// The new base configs, if set, supersede legacy settings.
if HasConnectionParams() {
for _, uc := range dbConfigs.userConfigs {
for _, uc := range dbConfigs.userConfigs {
if HasConnectionParams() {
uc.param.Host = baseConfig.Host
uc.param.Port = baseConfig.Port
uc.param.UnixSocket = baseConfig.UnixSocket
uc.param.Charset = baseConfig.Charset
uc.param.Flags = baseConfig.Flags
if uc.useSSL {
uc.param.SslCa = baseConfig.SslCa
uc.param.SslCaPath = baseConfig.SslCaPath
uc.param.SslCert = baseConfig.SslCert
uc.param.SslKey = baseConfig.SslKey
uc.param.ServerName = baseConfig.ServerName
}
} else if uc.param.UnixSocket == "" && uc.param.Host == "" {
uc.param.UnixSocket = defaultSocketFile
}
} else {
// Use supplied socket value if conn parameters are not specified.
for _, uc := range dbConfigs.userConfigs {
if uc.param.UnixSocket == "" && uc.param.Host == "" {
uc.param.UnixSocket = defaultSocketFile
}

uc.param.Charset = baseConfig.Charset
uc.param.Flags = baseConfig.Flags
if uc.useSSL {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure whether these should be left out when using a socket. @sougou what do you think?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not very useful to use SSL for sockets, but we don't care.

uc.param.SslCa = baseConfig.SslCa
uc.param.SslCaPath = baseConfig.SslCaPath
uc.param.SslCert = baseConfig.SslCert
uc.param.SslKey = baseConfig.SslKey
uc.param.ServerName = baseConfig.ServerName
}
}

Expand Down