From 85fc95f5d048f6c29ec10ee622cd99a95be1db28 Mon Sep 17 00:00:00 2001 From: volga629-1 <59034879+volga629-1@users.noreply.github.com> Date: Mon, 5 Oct 2020 20:02:29 -0300 Subject: [PATCH 1/2] Update database.go --- database/database.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/database/database.go b/database/database.go index 48dbe39d..985cb144 100644 --- a/database/database.go +++ b/database/database.go @@ -79,9 +79,9 @@ func ConnectString(dbName string) (string, error) { var dsn string driver := config.Setting.DBDriver addr := strings.Split(config.Setting.DBAddr, ":") - if len(addr) != 2 { - return "", fmt.Errorf("wrong database connection format: %v, it should be localhost:3306", config.Setting.DBAddr) - } + //if len(addr) != 2 { + // return "", fmt.Errorf("wrong database connection format: %v, it should be localhost:3306", config.Setting.DBAddr) + //} if (addr[1] == "3306" && driver == "postgres") || addr[1] == "5432" && driver == "mysql" { return "", fmt.Errorf("don't use port: %s, for db driver: %s", addr[1], driver) @@ -107,12 +107,14 @@ func ConnectString(dbName string) (string, error) { addr[0] = addr[1] addr[1] = "''" } - dsn = "sslmode=disable connect_timeout=4" + + sslmode = config.Setting.DBSSLMode or "disable" + dsn = "connect_timeout=4" + " host=" + addr[0] + " port=" + addr[1] + " dbname=" + dbName + " user=" + config.Setting.DBUser + " password=" + config.Setting.DBPass + " sslmode=" + sslmode } return dsn, nil } From fe4bdd31220dd00e917046c5a9db080fbcc319ac Mon Sep 17 00:00:00 2001 From: volga629-1 <59034879+volga629-1@users.noreply.github.com> Date: Mon, 5 Oct 2020 20:10:53 -0300 Subject: [PATCH 2/2] PgSQL SSL and PgSQL dsn hostname. #437 P2 PgSQL SSL and PgSQL dsn hostname. #437 P2 Config file adjustment --- example/homer7_config/heplify-server.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/example/homer7_config/heplify-server.toml b/example/homer7_config/heplify-server.toml index db10d2b8..2081b3b3 100644 --- a/example/homer7_config/heplify-server.toml +++ b/example/homer7_config/heplify-server.toml @@ -20,6 +20,7 @@ DBUser = "postgres" DBPass = "" DBDataTable = "homer_data" DBConfTable = "homer_config" +DBSSLMode = "disable" DBBulk = 200 DBTimer = 4 DBBuffer = 400000