Skip to content

Commit

Permalink
fix(core,frontend): change mysql config to default to correct values …
Browse files Browse the repository at this point in the history
…and make default time UTC
  • Loading branch information
hkdeman committed Feb 10, 2025
1 parent 89fb514 commit 8d181fd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
21 changes: 10 additions & 11 deletions core/src/plugins/mysql/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,21 @@ func DB(config *engine.PluginConfig) (*gorm.DB, error) {
return nil, err
}
parseTime := common.GetRecordValueOrDefault(config.Credentials.Advanced, parseTimeKey, "True")
loc, err := time.LoadLocation(common.GetRecordValueOrDefault(config.Credentials.Advanced, locKey, "Local"))
loc, err := time.LoadLocation(common.GetRecordValueOrDefault(config.Credentials.Advanced, locKey, "UTC"))
if err != nil {
return nil, err
}
allowClearTextPasswords := common.GetRecordValueOrDefault(config.Credentials.Advanced, allowClearTextPasswordsKey, "0")

mysqlConfig := mysqldriver.Config{
User: config.Credentials.Username,
Passwd: config.Credentials.Password,
Net: "tcp",
Addr: net.JoinHostPort(config.Credentials.Hostname, strconv.Itoa(port)),
DBName: config.Credentials.Database,
AllowCleartextPasswords: allowClearTextPasswords == "1",
ParseTime: strings.ToLower(parseTime) == "true",
Loc: loc,
}
mysqlConfig := mysqldriver.NewConfig()
mysqlConfig.User = config.Credentials.Username
mysqlConfig.Passwd = config.Credentials.Password
mysqlConfig.Net = "tcp"
mysqlConfig.Addr = net.JoinHostPort(config.Credentials.Hostname, strconv.Itoa(port))
mysqlConfig.DBName = config.Credentials.Database
mysqlConfig.AllowCleartextPasswords = allowClearTextPasswords == "1"
mysqlConfig.ParseTime = strings.ToLower(parseTime) == "true"
mysqlConfig.Loc = loc

// if this config is a pre-configured profile, then allow reading of additional params
if config.Credentials.IsProfile {
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/pages/auth/login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ const databaseTypeDropdownItems: IDropdownItem<Record<string, string>>[] = [
id: "MySQL",
label: "MySQL",
icon: Icons.Logos.MySQL,
extra: {"Port": "3306", "Parse Time": "True", "Loc": "Local", "Allow clear text passwords": "0"},
extra: {"Port": "3306", "Parse Time": "True", "Loc": "UTC", "Allow clear text passwords": "0"},
},
{
id: "MariaDB",
label: "MariaDB",
icon: Icons.Logos.MariaDB,
extra: {"Port": "3306", "Parse Time": "True", "Loc": "Local", "Allow clear text passwords": "0"},
extra: {"Port": "3306", "Parse Time": "True", "Loc": "UTC", "Allow clear text passwords": "0"},
},
{
id: "Sqlite3",
Expand Down

0 comments on commit 8d181fd

Please sign in to comment.