generated from gitea_admin/default
dev du parc
This commit is contained in:
25
server/utils/mysql.js
Normal file
25
server/utils/mysql.js
Normal file
@@ -0,0 +1,25 @@
|
||||
import mysql from "mysql2/promise"
|
||||
|
||||
let pool
|
||||
|
||||
export function getMysqlPool() {
|
||||
if (pool) {
|
||||
return pool
|
||||
}
|
||||
|
||||
const config = useRuntimeConfig()
|
||||
|
||||
pool = mysql.createPool({
|
||||
host: config.mysqlHost,
|
||||
port: Number(config.mysqlPort || 3306),
|
||||
database: config.mysqlDatabase,
|
||||
user: config.mysqlUser,
|
||||
password: config.mysqlPassword,
|
||||
waitForConnections: true,
|
||||
connectionLimit: 10,
|
||||
queueLimit: 0,
|
||||
charset: "utf8mb4",
|
||||
})
|
||||
|
||||
return pool
|
||||
}
|
||||
Reference in New Issue
Block a user