Skip to content

Commit

Permalink
config: connect to cleaned DSN
Browse files Browse the repository at this point in the history
Closes #464
  • Loading branch information
arekkas committed May 24, 2017
1 parent 69f0c2f commit 78ea521
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions config/backend_connections.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ func (c *SQLConnection) GetDatabase() *sqlx.DB {

if err = pkg.Retry(c.L, time.Second*15, time.Minute*2, func() error {
c.L.Infof("Connecting with %s", c.URL.Scheme+"://*:*@"+c.URL.Host+c.URL.Path+"?"+clean.RawQuery)
u := c.URL.String()
if c.URL.Scheme == "mysql" {
u := clean.String()
if clean.Scheme == "mysql" {
u = strings.Replace(u, "mysql://", "", -1)
}

if c.db, err = sqlx.Open(c.URL.Scheme, u); err != nil {
if c.db, err = sqlx.Open(clean.Scheme, u); err != nil {
return errors.Errorf("Could not connect to SQL: %s", err)
} else if err := c.db.Ping(); err != nil {
return errors.Errorf("Could not connect to SQL: %s", err)
Expand Down

0 comments on commit 78ea521

Please sign in to comment.