|
|
|
@ -8,6 +8,7 @@ import ( |
|
|
|
|
"html/template" |
|
|
|
|
"io/ioutil" |
|
|
|
|
"net/http" |
|
|
|
|
"net/url" |
|
|
|
|
"os" |
|
|
|
|
"os/signal" |
|
|
|
|
"regexp" |
|
|
|
@ -362,7 +363,7 @@ func Serve() { |
|
|
|
|
|
|
|
|
|
func connectToDatabase(app *app) { |
|
|
|
|
log.Info("Connecting to database...") |
|
|
|
|
db, err := sql.Open("mysql", fmt.Sprintf("%s:%s@tcp(%s:%d)/%s?charset=utf8mb4&parseTime=true", app.cfg.Database.User, app.cfg.Database.Password, app.cfg.Database.Host, app.cfg.Database.Port, app.cfg.Database.Database)) |
|
|
|
|
db, err := sql.Open("mysql", fmt.Sprintf("%s:%s@tcp(%s:%d)/%s?charset=utf8mb4&parseTime=true&loc=%s", app.cfg.Database.User, app.cfg.Database.Password, app.cfg.Database.Host, app.cfg.Database.Port, app.cfg.Database.Database, url.QueryEscape(time.Local.String()))) |
|
|
|
|
if err != nil { |
|
|
|
|
log.Error("%s", err) |
|
|
|
|
os.Exit(1) |
|
|
|
|