overleaf-cep/services/history-v1/storage/lib/knex_read_only.js
Jakob Ackermann 3a4c5a0d0f [history-v1] add readOnly lookup for raw chunks (#23318)
* [history-v1] add readOnly lookup for raw chunks

Co-authored-by: Eric Mc Sween <eric.mcsween@overleaf.com>

* [history-v1] reduce min poolsize for readOnly pool to 0

Co-authored-by: Brian Gough <brian.gough@overleaf.com>

---------

Co-authored-by: Eric Mc Sween <eric.mcsween@overleaf.com>
Co-authored-by: Brian Gough <brian.gough@overleaf.com>
GitOrigin-RevId: a711c4ee4f3ea3775bd090e620d1ef52689fa1f4
2025-02-04 09:04:52 +00:00

19 lines
394 B
JavaScript

'use strict'
const config = require('config')
const knexfile = require('../../knexfile')
const env = process.env.NODE_ENV || 'development'
if (config.databaseUrlReadOnly) {
module.exports = require('knex')({
...knexfile[env],
pool: {
...knexfile[env].pool,
min: 0,
},
connection: config.databaseUrlReadOnly,
})
} else {
module.exports = require('./knex')
}