switch to viper for configuration and use cobra for cli

This commit is contained in:
Nicola Murino
2019-08-07 22:46:13 +02:00
parent 13d4489c48
commit 8f421b7d0f
21 changed files with 532 additions and 200 deletions

View File

@@ -25,12 +25,12 @@ func initializeMySQLProvider() error {
dbHandle, err = sql.Open("mysql", connectionString)
if err == nil {
numCPU := runtime.NumCPU()
logger.Debug(logSender, "mysql database handle created, connection string: \"%v\", pool size: %v", connectionString, numCPU)
logger.Debug(logSender, "mysql database handle created, connection string: '%v', pool size: %v", connectionString, numCPU)
dbHandle.SetMaxIdleConns(numCPU)
dbHandle.SetMaxOpenConns(numCPU)
dbHandle.SetConnMaxLifetime(1800 * time.Second)
} else {
logger.Warn(logSender, "error creating mysql database handler, connection string: \"%v\", error: %v", connectionString, err)
logger.Warn(logSender, "error creating mysql database handler, connection string: '%v', error: %v", connectionString, err)
}
return err
}