mirror of
https://github.com/acepanel/panel.git
synced 2026-02-05 00:39:32 +08:00
79 lines
2.4 KiB
Go
79 lines
2.4 KiB
Go
package config
|
|
|
|
import (
|
|
"github.com/goravel/framework/facades"
|
|
)
|
|
|
|
func init() {
|
|
config := facades.Config()
|
|
config.Add("database", map[string]any{
|
|
// Default database connection name
|
|
"default": "panel",
|
|
|
|
// Database connections
|
|
"connections": map[string]any{
|
|
"panel": map[string]any{
|
|
"driver": "sqlite",
|
|
"database": "/www/panel/database/panel.db",
|
|
"prefix": "",
|
|
"singular": false, // Table name is singular
|
|
},
|
|
},
|
|
|
|
// Set pool configuration
|
|
"pool": map[string]any{
|
|
// Sets the maximum number of connections in the idle
|
|
// connection pool.
|
|
//
|
|
// If MaxOpenConns is greater than 0 but less than the new MaxIdleConns,
|
|
// then the new MaxIdleConns will be reduced to match the MaxOpenConns limit.
|
|
//
|
|
// If n <= 0, no idle connections are retained.
|
|
"max_idle_conns": 10,
|
|
// Sets the maximum number of open connections to the database.
|
|
//
|
|
// If MaxIdleConns is greater than 0 and the new MaxOpenConns is less than
|
|
// MaxIdleConns, then MaxIdleConns will be reduced to match the new
|
|
// MaxOpenConns limit.
|
|
//
|
|
// If n <= 0, then there is no limit on the number of open connections.
|
|
"max_open_conns": 100,
|
|
// Sets the maximum amount of time a connection may be idle.
|
|
//
|
|
// Expired connections may be closed lazily before reuse.
|
|
//
|
|
// If d <= 0, connections are not closed due to a connection's idle time.
|
|
// Unit: Second
|
|
"conn_max_idletime": 3600,
|
|
// Sets the maximum amount of time a connection may be reused.
|
|
//
|
|
// Expired connections may be closed lazily before reuse.
|
|
//
|
|
// If d <= 0, connections are not closed due to a connection's age.
|
|
// Unit: Second
|
|
"conn_max_lifetime": 3600,
|
|
},
|
|
|
|
// Migration Repository Table
|
|
//
|
|
// This table keeps track of all the migrations that have already run for
|
|
// your application. Using this information, we can determine which of
|
|
// the migrations on disk haven't actually been run in the database.
|
|
"migrations": "migrations",
|
|
|
|
// Redis Databases
|
|
//
|
|
// Redis is an open source, fast, and advanced key-value store that also
|
|
// provides a richer body of commands than a typical key-value system
|
|
// such as APC or Memcached.
|
|
"redis": map[string]any{
|
|
"default": map[string]any{
|
|
"host": config.Env("REDIS_HOST", ""),
|
|
"password": config.Env("REDIS_PASSWORD", ""),
|
|
"port": config.Env("REDIS_PORT", 6379),
|
|
"database": config.Env("REDIS_DB", 0),
|
|
},
|
|
},
|
|
})
|
|
}
|