Skip to content

Commit

Permalink
change variable name and use one call instead
Browse files Browse the repository at this point in the history
  • Loading branch information
jwwandy committed Aug 4, 2019
1 parent d6ae5c4 commit d1217b2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
10 changes: 5 additions & 5 deletions backend/src/apiserver/client_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ const (
minioServiceHost = "MINIO_SERVICE_SERVICE_HOST"
minioServicePort = "MINIO_SERVICE_SERVICE_PORT"
mysqlServiceHost = "MYSQL_SERVICE_HOST"
mysqlServicePort = "MYSQL_SERVICE_PORT"
mysqlUser = "DBConfig.User"
mysqlPassword = "DBConfig.Password"
mysqlServicePort = "MYSQL_SERVICE_PORT"
mysqlDBName = "DBConfig.DBName"

podNamespace = "POD_NAMESPACE"
dbName = "DBConfig.dbName"
initConnectionTimeout = "InitConnectionTimeout"
)

Expand Down Expand Up @@ -247,8 +247,8 @@ func initMysql(driverName string, initConnectionTimeout time.Duration) string {

// Create database if not exist
operation = func() error {
_, err = db.Exec(fmt.Sprintf("CREATE DATABASE IF NOT EXISTS %s",
getStringConfigWithDefault(dbName, "mlpipeline")))
dbName := getStringConfig(mysqlDBName)
_, err = db.Exec(fmt.Sprintf("CREATE DATABASE IF NOT EXISTS %s", dbName))
if err != nil {
return err
}
Expand All @@ -259,7 +259,7 @@ func initMysql(driverName string, initConnectionTimeout time.Duration) string {
err = backoff.Retry(operation, b)

util.TerminateIfError(err)
mysqlConfig.DBName = getStringConfigWithDefault(dbName, "mlpipeline")
mysqlConfig.DBName = dbName
return mysqlConfig.FormatDSN()
}

Expand Down
3 changes: 2 additions & 1 deletion backend/src/apiserver/config/config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"DBConfig": {
"DriverName": "mysql",
"DataSourceName": ""
"DataSourceName": "",
"DBName": "mlpipeline"
},
"ObjectStoreConfig":{
"AccessKey": "minio",
Expand Down

0 comments on commit d1217b2

Please sign in to comment.