mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
Moved sqlite3 override rules to db connection lib
- We have an already established location for special rules based on db client - Removes the need to require config inside of overrides
This commit is contained in:
parent
f6a7abdf5a
commit
256b77b0e4
2 changed files with 5 additions and 11 deletions
|
@ -12,7 +12,12 @@ function configure(dbConfig) {
|
||||||
const client = dbConfig.client;
|
const client = dbConfig.client;
|
||||||
|
|
||||||
if (client === 'sqlite3') {
|
if (client === 'sqlite3') {
|
||||||
|
// Backwards compatibility with old knex behaviour
|
||||||
dbConfig.useNullAsDefault = Object.prototype.hasOwnProperty.call(dbConfig, 'useNullAsDefault') ? dbConfig.useNullAsDefault : true;
|
dbConfig.useNullAsDefault = Object.prototype.hasOwnProperty.call(dbConfig, 'useNullAsDefault') ? dbConfig.useNullAsDefault : true;
|
||||||
|
|
||||||
|
// Force bthreads to use child_process backend until a worker_thread-compatible version of sqlite3 is published
|
||||||
|
// https://github.com/mapbox/node-sqlite3/issues/1386
|
||||||
|
process.env.BTHREADS_BACKEND = 'child_process';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (client === 'mysql') {
|
if (client === 'mysql') {
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
const config = require('../shared/config');
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If we enable bluebird debug logs we see a huge memory usage.
|
* If we enable bluebird debug logs we see a huge memory usage.
|
||||||
* You can reproduce by removing this line and import a big database export into Ghost.
|
* You can reproduce by removing this line and import a big database export into Ghost.
|
||||||
|
@ -7,15 +5,6 @@ const config = require('../shared/config');
|
||||||
*/
|
*/
|
||||||
process.env.BLUEBIRD_DEBUG = 0;
|
process.env.BLUEBIRD_DEBUG = 0;
|
||||||
|
|
||||||
/**
|
|
||||||
* Force bthreads to use child_process backend until a worker_thread-compatible version of sqlite3 is published
|
|
||||||
* https://github.com/mapbox/node-sqlite3/issues/1386
|
|
||||||
*/
|
|
||||||
const isSQLite = config.get('database:client') === 'sqlite3';
|
|
||||||
if (isSQLite) {
|
|
||||||
process.env.BTHREADS_BACKEND = 'child_process';
|
|
||||||
}
|
|
||||||
|
|
||||||
const moment = require('moment-timezone');
|
const moment = require('moment-timezone');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue