Skip to content

Commit

Permalink
use url encode in mysql dns generation
Browse files Browse the repository at this point in the history
  • Loading branch information
cenkalti committed Oct 2, 2020
1 parent 3597cfc commit 450611c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package dalga

import (
"fmt"
"net/url"
"time"
)

Expand Down Expand Up @@ -65,7 +66,10 @@ type mysqlConfig struct {
}

func (c mysqlConfig) DSN() string {
return fmt.Sprintf("%s:%s@tcp(%s:%d)/%s?parseTime=true&multiStatements=true", c.User, c.Password, c.Host, c.Port, c.DB)
v := url.Values{}
v.Set("parseTime", "true")
v.Set("multiStatements", "true")
return fmt.Sprintf("%s:%s@tcp(%s:%d)/%s?"+v.Encode(), c.User, c.Password, c.Host, c.Port, c.DB)
}

type listenConfig struct {
Expand Down

0 comments on commit 450611c

Please sign in to comment.