Рефакторинг
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
const fs = require('fs-extra');
|
||||
const Logger = require('./Logger');
|
||||
const configManager = new (require('../config'))();//singleton
|
||||
|
||||
let instance = null;
|
||||
|
||||
@@ -15,11 +14,10 @@ class AppLogger {
|
||||
return instance;
|
||||
}
|
||||
|
||||
async init() {
|
||||
async init(config) {
|
||||
if (this.inited)
|
||||
throw new Error('already inited');
|
||||
|
||||
let config = configManager.config;
|
||||
let loggerParams = null;
|
||||
|
||||
if (config.loggingEnabled) {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
const fs = require('fs-extra');
|
||||
|
||||
const SqliteConnectionPool = require('./SqliteConnectionPool');
|
||||
const configManager = new (require('../config'))();//singleton
|
||||
const log = new (require('../core/AppLogger'))().log;//singleton
|
||||
|
||||
const migrations = {
|
||||
@@ -24,7 +23,7 @@ class ConnManager {
|
||||
}
|
||||
|
||||
async init(config) {
|
||||
this.config = configManager.config;
|
||||
this.config = config;
|
||||
this._pool = {};
|
||||
|
||||
const force = null;//(config.branch == 'development' ? 'last' : null);
|
||||
|
||||
@@ -14,7 +14,7 @@ async function init() {
|
||||
|
||||
//logger
|
||||
const appLogger = new (require('./core/AppLogger'))();//singleton
|
||||
await appLogger.init();
|
||||
await appLogger.init(config);
|
||||
const log = appLogger.log;
|
||||
|
||||
//dirs
|
||||
@@ -37,7 +37,7 @@ async function init() {
|
||||
|
||||
//connections
|
||||
const connManager = new (require('./db/ConnManager'))();//singleton
|
||||
await connManager.init();
|
||||
await connManager.init(config);
|
||||
}
|
||||
|
||||
async function main() {
|
||||
|
||||
Reference in New Issue
Block a user