Add buildDatabaseUrl and a CLI helper to print it
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,11 @@ import mariadb from 'mariadb';
|
||||
|
||||
let pool;
|
||||
|
||||
export function buildDatabaseUrl(config) {
|
||||
const { host, user, password, database } = config.db;
|
||||
return `mysql://${encodeURIComponent(user)}:${encodeURIComponent(password)}@${host}:3306/${database}?connection_limit=10`;
|
||||
}
|
||||
|
||||
export function getPool(config) {
|
||||
if (!pool) {
|
||||
pool = mariadb.createPool({
|
||||
|
||||
Reference in New Issue
Block a user