Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

configure db host and port from from config file #1940

Merged
merged 4 commits into from
Sep 18, 2019
Merged
Changes from 1 commit
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
26 changes: 13 additions & 13 deletions backend/src/apiserver/client_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ package main
import (
"database/sql"
"fmt"
v1 "k8s.io/client-go/kubernetes/typed/core/v1"
"os"
"time"

v1 "k8s.io/client-go/kubernetes/typed/core/v1"

workflowclient "github.com/argoproj/argo/pkg/client/clientset/versioned/typed/workflow/v1alpha1"
"github.com/cenkalti/backoff"
"github.com/golang/glog"
Expand All @@ -36,13 +37,13 @@ import (
)

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"
mysqlDBName = "DBConfig.DBName"
minioServiceHost = "MINIO_SERVICE_SERVICE_HOST"
minioServicePort = "MINIO_SERVICE_SERVICE_PORT"
mysqlServiceHost = "DBConfig.Host"
mysqlServicePort = "DBConfig.Port"
mysqlUser = "DBConfig.User"
mysqlPassword = "DBConfig.Password"
mysqlDBName = "DBConfig.DBName"

podNamespace = "POD_NAMESPACE"
initConnectionTimeout = "InitConnectionTimeout"
Expand All @@ -64,7 +65,7 @@ type ClientManager struct {
objectStore storage.ObjectStoreInterface
wfClient workflowclient.WorkflowInterface
swfClient scheduledworkflowclient.ScheduledWorkflowInterface
podClient v1.PodInterface
podClient v1.PodInterface
time util.TimeInterface
uuid util.UUIDGeneratorInterface
}
Expand Down Expand Up @@ -122,8 +123,7 @@ func (c *ClientManager) UUID() util.UUIDGeneratorInterface {
}

func (c *ClientManager) init() {
glog.Infof("Initializing client manager")

glog.Info("Initializing client manager")
db := initDBClient(getDurationConfig(initConnectionTimeout))

// time
Expand Down Expand Up @@ -210,8 +210,8 @@ func initMysql(driverName string, initConnectionTimeout time.Duration) string {
mysqlConfig := client.CreateMySQLConfig(
getStringConfigWithDefault(mysqlUser, "root"),
getStringConfigWithDefault(mysqlPassword, ""),
getStringConfig(mysqlServiceHost),
getStringConfig(mysqlServicePort),
getStringConfigWithDefault(mysqlServiceHost, "mysql"),
xaniasd marked this conversation as resolved.
Show resolved Hide resolved
getStringConfigWithDefault(mysqlServicePort, "3306"),
"")

var db *sql.DB
Expand Down