Skip to content

Commit 9e5c7b8

Browse files
committed
added custom cli
1 parent e03dc66 commit 9e5c7b8

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

main.go

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1166,16 +1166,21 @@ func getDataDBSession() (map[string]*gorm.DB, []model.DatabasesMap) {
11661166
keepAlive = viper.GetBool(keyData + ".keepalive")
11671167
}
11681168

1169+
customcli := ""
1170+
if viper.IsSet(keyData + ".custom_cli") {
1171+
customcli = viper.GetString(keyData + ".custom_cli")
1172+
}
1173+
11691174
sslMode := "disable"
11701175
if viper.IsSet(keyData + ".sslmode") {
11711176
sslMode = viper.GetString(keyData + ".sslmode")
11721177
} else if viper.IsSet(keyData+".usessl") && viper.GetBool(keyData+".usessl") {
11731178
sslMode = "require"
11741179
}
11751180

1176-
logger.Info(fmt.Sprintf("Connecting to [%s, %s, %s, %s, %d, ssl: %s]\n", host, user, name, node, port, sslMode))
1181+
logger.Info(fmt.Sprintf("Connecting to [%s, %s, %s, %s, %d, ssl: %s, custom_cli: %s]\n", host, user, name, node, port, sslMode, customcli))
11771182

1178-
connectString := fmt.Sprintf("host=%s user=%s dbname=%s sslmode=%s password=%s", host, user, name, sslMode, password)
1183+
connectString := fmt.Sprintf("host=%s user=%s dbname=%s sslmode=%s password=%s %s", host, user, name, sslMode, password, customcli)
11791184

11801185
if port != 0 {
11811186
connectString += fmt.Sprintf(" port=%d", port)
@@ -1273,7 +1278,12 @@ func getDataDBSession() (map[string]*gorm.DB, []model.DatabasesMap) {
12731278
keepAlive = viper.GetBool("database_data.keepalive")
12741279
}
12751280

1276-
logger.Info(fmt.Sprintf("Connecting to the old way: [%s, %s, %s, %d]\n", host, user, name, port))
1281+
customcli := ""
1282+
if viper.IsSet("database_data.custom_cli") {
1283+
customcli = viper.GetString("database_data.custom_cli")
1284+
}
1285+
1286+
logger.Info(fmt.Sprintf("Connecting to the old way: [%s, %s, %s, %d, %s]\n", host, user, name, port, customcli))
12771287

12781288
sslMode := "disable"
12791289
if viper.IsSet("database_data.sslmode") {
@@ -1282,7 +1292,7 @@ func getDataDBSession() (map[string]*gorm.DB, []model.DatabasesMap) {
12821292
sslMode = "require"
12831293
}
12841294

1285-
connectString := fmt.Sprintf("host=%s user=%s dbname=%s sslmode=%s password=%s", host, user, name, sslMode, password)
1295+
connectString := fmt.Sprintf("host=%s user=%s dbname=%s sslmode=%s password=%s %s", host, user, name, sslMode, password, customcli)
12861296

12871297
if port != 0 {
12881298
connectString += fmt.Sprintf(" port=%d", port)
@@ -1357,7 +1367,12 @@ func getConfigDBSession() *gorm.DB {
13571367
sslMode = "require"
13581368
}
13591369

1360-
connectString := fmt.Sprintf("host=%s user=%s dbname=%s sslmode=%s password=%s", host, user, name, sslMode, password)
1370+
customcli := ""
1371+
if viper.IsSet("database_config.custom_cli") {
1372+
customcli = viper.GetString("database_config.custom_cli")
1373+
}
1374+
1375+
connectString := fmt.Sprintf("host=%s user=%s dbname=%s sslmode=%s password=%s %s", host, user, name, sslMode, password, customcli)
13611376

13621377
if port != 0 {
13631378
connectString += fmt.Sprintf(" port=%d", port)

version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package main
22

33
// VERSION
4-
var VERSION_APPLICATION = "1.5.2"
4+
var VERSION_APPLICATION = "1.5.3"
55

66
// NAME
77
var NAME_APPLICATION = "homer-app"

0 commit comments

Comments
 (0)