add support for PostgreSQL (and other databases)

* renamed the 'mysql' config.yaml key to 'database'
* added database.client which still defaults to 'mysql'
This commit is contained in:
secretspecter 2023-12-14 22:11:17 -07:00
parent 227244e2d0
commit 0b806cec92
2 changed files with 10 additions and 9 deletions

View file

@ -11,7 +11,8 @@ import { CaptchaConfig } from './configuration/captchaconfig';
const LOGGER = require('@calzoneman/jsli')('config');
var defaults = {
mysql: {
database: {
client: "mysql",
server: "localhost",
port: 3306,
database: "cytube3",

View file

@ -30,19 +30,19 @@ class Database {
constructor(knexConfig = null) {
if (knexConfig === null) {
knexConfig = {
client: 'mysql',
client: 'database',
connection: {
host: Config.get('mysql.server'),
port: Config.get('mysql.port'),
user: Config.get('mysql.user'),
password: Config.get('mysql.password'),
database: Config.get('mysql.database'),
host: Config.get('database.server'),
port: Config.get('database.port'),
user: Config.get('database.user'),
password: Config.get('database.password'),
database: Config.get('database.database'),
multipleStatements: true, // Legacy thing
charset: 'utf8mb4'
},
pool: {
min: Config.get('mysql.pool-size'),
max: Config.get('mysql.pool-size')
min: Config.get('database.pool-size'),
max: Config.get('database.pool-size')
},
debug: !!process.env.KNEX_DEBUG
};