Skip to content
Open
Show file tree
Hide file tree
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
15 changes: 15 additions & 0 deletions database/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,21 @@ func NewDatabase(cnf *config.Config) (*gorm.DB, error) {

return db, nil
}
if cnf.Database.Type == "mysql" {
args := fmt.Sprintf(
"%s:%s@tcp(%s:%d)/%s?charset=utf8&parseTime=True",
cnf.Database.User,
cnf.Database.Password,
cnf.Database.Host,
cnf.Database.Port,
cnf.Database.DatabaseName,
)
db, err := gorm.Open("mysql", args)
if err != nil {
return db, err
}
return db, nil
}

// Database type not supported
return nil, fmt.Errorf("Database type %s not suppported", cnf.Database.Type)
Expand Down
2 changes: 1 addition & 1 deletion oauth/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func (s *Service) ClientExists(clientID string) bool {
func (s *Service) FindClientByClientID(clientID string) (*models.OauthClient, error) {
// Client IDs are case insensitive
client := new(models.OauthClient)
notFound := s.db.Where("key = LOWER(?)", clientID).
notFound := s.db.Where("`key` = LOWER(?)", clientID).
First(client).RecordNotFound()

// Not found
Expand Down