Skip to content

Commit

Permalink
optimize MySqlKongVars func
Browse files Browse the repository at this point in the history
  • Loading branch information
thirdeyenick committed Apr 22, 2024
1 parent 0e469bd commit e342021
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
4 changes: 2 additions & 2 deletions create/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func (cmd *mySQLCmd) newMySQL(namespace string) *storage.MySQL {

// ApplicationKongVars returns all variables which are used in the application
// create command
func MySQLKongVars() (kong.Vars, error) {
func MySQLKongVars() kong.Vars {
vmTypes := make([]string, len(infra.MachineTypes))
for i, machineType := range infra.MachineTypes {
vmTypes[i] = string(machineType)
Expand All @@ -128,5 +128,5 @@ func MySQLKongVars() (kong.Vars, error) {
result["mysql_min_word_length"] = fmt.Sprintf("%d", storage.MySQLMinWordLengthDefault)
result["mysql_transaction_isolation"] = string(storage.MySQLTransactionIsolationDefault)
result["mysql_backup_retention_days"] = fmt.Sprintf("%d", storage.MySQLBackupRetentionDaysDefault)
return result, nil
return result
}
7 changes: 1 addition & 6 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,7 @@ func kongVariables() (kong.Vars, error) {
if err != nil {
return nil, fmt.Errorf("error on application create kong vars: %w", err)
}
mysqlCreateKongVars, err := create.MySQLKongVars()
if err != nil {
return nil, fmt.Errorf("error on mysql create kong vars: %w", err)
}

if err := merge(result, appCreateKongVars, mysqlCreateKongVars); err != nil {
if err := merge(result, appCreateKongVars, create.MySQLKongVars()); err != nil {
return nil, fmt.Errorf("error when merging kong variables: %w", err)
}

Expand Down

0 comments on commit e342021

Please sign in to comment.