refactor: logging + search modules PH

This commit is contained in:
Nicolas Giard
2018-08-31 23:42:14 -04:00
parent 23f07381c2
commit 9c6a4f6c20
34 changed files with 327 additions and 189 deletions

View File

@@ -1,4 +1,5 @@
const path = require('path')
const os = require('os')
/* global WIKI */
@@ -89,16 +90,11 @@ module.exports = () => {
})
}
// Update config file
WIKI.logger.info('Writing config file to disk...')
let confRaw = await fs.readFileAsync(path.join(WIKI.ROOTPATH, 'config.yml'), 'utf8')
let conf = yaml.safeLoad(confRaw)
// Create directory structure
await fs.ensureDir(conf.paths.data)
await fs.ensureDir(path.join(conf.paths.data, 'cache'))
await fs.ensureDir(path.join(conf.paths.data, 'temp-upload'))
await fs.ensureDir(conf.paths.content)
const tmpPath = path.join(os.tmpdir(), 'wikijs')
await fs.ensureDir(tmpPath)
await fs.ensureDir(path.join(tmpPath, 'cache'))
await fs.ensureDir(path.join(tmpPath, 'uploads'))
// Set config
_.set(WIKI.config, 'defaultEditor', 'markdown')
@@ -237,7 +233,7 @@ module.exports = () => {
app.set('port', WIKI.config.port)
WIKI.server = http.createServer(app)
WIKI.server.listen(WIKI.config.port)
WIKI.server.listen(WIKI.config.port, WIKI.config.bindIP)
var openConnections = []