mirror of
https://github.com/go-vikunja/vikunja.git
synced 2026-02-01 22:47:40 +00:00
Added config for database max connections
This commit is contained in:
@@ -45,6 +45,9 @@ database:
|
||||
Path: "./vikunja.db"
|
||||
# Whether to show mysql queries or not. Useful for debugging.
|
||||
showqueries: "false"
|
||||
# Sets the max open connections to the database. Only used when using mysql.
|
||||
openconnections: 100
|
||||
|
||||
|
||||
cache:
|
||||
# If cache is enabled or not
|
||||
|
||||
@@ -27,6 +27,7 @@ func InitConfig() (err error) {
|
||||
viper.SetDefault("database.database", "vikunja")
|
||||
viper.SetDefault("database.path", "./vikunja.db")
|
||||
viper.SetDefault("database.showqueries", false)
|
||||
viper.SetDefault("database.openconnections", 100)
|
||||
// Cacher
|
||||
viper.SetDefault("cache.enabled", false)
|
||||
viper.SetDefault("cache.type", "memory")
|
||||
|
||||
@@ -27,7 +27,9 @@ func getEngine() (*xorm.Engine, error) {
|
||||
viper.GetString("database.password"),
|
||||
viper.GetString("database.host"),
|
||||
viper.GetString("database.database"))
|
||||
return xorm.NewEngine("mysql", connStr)
|
||||
e, err := xorm.NewEngine("mysql", connStr)
|
||||
e.SetMaxOpenConns(viper.GetInt("database.openconnections"))
|
||||
return e, err
|
||||
}
|
||||
|
||||
// Otherwise use sqlite
|
||||
|
||||
Reference in New Issue
Block a user