From 1ed058a55360aab6c7348ffec8b6a2ac535e1d80 Mon Sep 17 00:00:00 2001 From: Book Pauk Date: Mon, 23 Dec 2019 20:57:44 +0700 Subject: [PATCH] =?UTF-8?q?=D0=9C=D0=B5=D0=BB=D0=BA=D0=B8=D0=B5=20=D0=BF?= =?UTF-8?q?=D0=BE=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/config/index.js | 3 ++- server/index.js | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/server/config/index.js b/server/config/index.js index fd8ae045..bd17f7b3 100644 --- a/server/config/index.js +++ b/server/config/index.js @@ -41,9 +41,9 @@ class ConfigManager { process.env.NODE_ENV = this.branch; this.branchConfigFile = __dirname + `/${this.branch}.js`; - await fs.access(this.branchConfigFile); this._config = require(this.branchConfigFile); + await fs.ensureDir(this._config.dataDir); this._userConfigFile = `${this._config.dataDir}/config.json`; this.inited = true; @@ -83,6 +83,7 @@ class ConfigManager { async save() { if (!this.inited) throw new Error('not inited'); + const dataToSave = _.pick(this._config, propsToSave); await fs.writeFile(this.userConfigFile, JSON.stringify(dataToSave, null, 4)); } diff --git a/server/index.js b/server/index.js index 73563630..0be2e115 100644 --- a/server/index.js +++ b/server/index.js @@ -18,7 +18,7 @@ async function init() { const log = appLogger.log; //dirs - log(`${config.name} v${config.version}`); + log(`${config.name} v${config.version}, Node.js ${process.version}`); log('Initializing'); await fs.ensureDir(config.dataDir); @@ -40,7 +40,7 @@ async function init() { await connManager.init(config); } -async function main() { +async function main() { const log = new (require('./core/AppLogger'))().log;//singleton const config = new (require('./config'))().config;//singleton