If using MySQL check for parseTime=true in DSN, if not there add it
This commit is contained in:
parent
7198f9e166
commit
9b715a6e9e
|
|
@ -11,6 +11,7 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"net/url"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
@ -49,22 +50,39 @@ type authzModel struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewSQLStorageAuthority provides persistence using a SQL backend for Boulder.
|
// NewSQLStorageAuthority provides persistence using a SQL backend for Boulder.
|
||||||
func NewSQLStorageAuthority(driver string, dbConnect string) (ssa *SQLStorageAuthority, err error) {
|
func NewSQLStorageAuthority(driver string, dbConnect string) (*SQLStorageAuthority, error) {
|
||||||
logger := blog.GetAuditLogger()
|
logger := blog.GetAuditLogger()
|
||||||
logger.Notice("Storage Authority Starting")
|
logger.Notice("Storage Authority Starting")
|
||||||
|
|
||||||
dbMap, err := NewDbMap(driver, dbConnect)
|
if driver == "mysql" {
|
||||||
if err != nil {
|
// Check the parseTime=true DSN is present
|
||||||
return
|
dbURI, err := url.Parse(dbConnect)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
dsnVals, err := url.ParseQuery(dbURI.RawQuery)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if k := dsnVals.Get("parseTime"); k != "true" {
|
||||||
|
dsnVals.Set("parseTime", "true")
|
||||||
|
dbURI.RawQuery = dsnVals.Encode()
|
||||||
|
}
|
||||||
|
dbConnect = dbURI.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
ssa = &SQLStorageAuthority{
|
dbMap, err := NewDbMap(driver, dbConnect)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
ssa := &SQLStorageAuthority{
|
||||||
dbMap: dbMap,
|
dbMap: dbMap,
|
||||||
log: logger,
|
log: logger,
|
||||||
bucket: make(map[string]interface{}),
|
bucket: make(map[string]interface{}),
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return ssa, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetSQLDebug enables/disables GORP SQL-level Debugging
|
// SetSQLDebug enables/disables GORP SQL-level Debugging
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue