Мелкие поправки
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user