adding ORM pool configuration

pull/901/head
Rigel Kent 2018-07-28 21:02:26 +02:00 committed by Chocobozzz
parent 040467f5c8
commit 1c3386e87f
5 changed files with 13 additions and 2 deletions

View File

@ -22,6 +22,8 @@ database:
suffix: '_dev'
username: 'peertube'
password: 'peertube'
pool:
max: 5
# You can also specify a 'socket' path to a unix socket but first need to
# comment out hostname and port

View File

@ -21,6 +21,8 @@ database:
suffix: '_prod'
username: 'peertube'
password: 'peertube'
pool:
max: 5
# Redis server for short time storage
# You can also specify a 'socket' path to a unix socket but first need to

View File

@ -43,7 +43,7 @@ function checkMissedConfig () {
const required = [ 'listen.port', 'listen.hostname',
'webserver.https', 'webserver.hostname', 'webserver.port',
'trust_proxy',
'database.hostname', 'database.port', 'database.suffix', 'database.username', 'database.password',
'database.hostname', 'database.port', 'database.suffix', 'database.username', 'database.password', 'database.pool.max',
'smtp.hostname', 'smtp.port', 'smtp.username', 'smtp.password', 'smtp.tls', 'smtp.from_address',
'storage.avatars', 'storage.videos', 'storage.logs', 'storage.previews', 'storage.thumbnails', 'storage.torrents', 'storage.cache',
'log.level',

View File

@ -121,7 +121,10 @@ const CONFIG = {
HOSTNAME: config.get<string>('database.hostname'),
PORT: config.get<number>('database.port'),
USERNAME: config.get<string>('database.username'),
PASSWORD: config.get<string>('database.password')
PASSWORD: config.get<string>('database.password'),
POOL: {
MAX: config.get<number>('database.pool.max')
}
},
REDIS: {
HOSTNAME: config.has('redis.hostname') ? config.get<string>('redis.hostname') : null,

View File

@ -32,6 +32,7 @@ const username = CONFIG.DATABASE.USERNAME
const password = CONFIG.DATABASE.PASSWORD
const host = CONFIG.DATABASE.HOSTNAME
const port = CONFIG.DATABASE.PORT
const poolMax = CONFIG.DATABASE.POOL.MAX
const sequelizeTypescript = new SequelizeTypescript({
database: dbname,
@ -40,6 +41,9 @@ const sequelizeTypescript = new SequelizeTypescript({
port,
username,
password,
pool: {
max: poolMax
},
benchmark: isTestInstance(),
isolationLevel: SequelizeTypescript.Transaction.ISOLATION_LEVELS.SERIALIZABLE,
operatorsAliases: false,