minor with logging and cleanup bootstrap
This commit is contained in:
@@ -25,15 +25,15 @@ const Auth = {
|
||||
if (res.locals.user) {
|
||||
next()
|
||||
} else {
|
||||
res.sendStatus(404)
|
||||
res.sendStatus(403)
|
||||
}
|
||||
},
|
||||
|
||||
isAdmin (req, res, next) {
|
||||
if (res.locals.user.is_admin) {
|
||||
if (res.locals.users && res.locals.user.is_admin) {
|
||||
next()
|
||||
} else {
|
||||
res.status(404)
|
||||
res.sendStatus(403)
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ oauth.use((req, res) => res.sendStatus(404))
|
||||
|
||||
oauth.use((err, req, res, next) => {
|
||||
const error_msg = err.toString()
|
||||
log.error('[OAUTH USE] ' + error_msg)
|
||||
log.warn('[OAUTH USE] ' + error_msg)
|
||||
res.status(500).send(error_msg)
|
||||
})
|
||||
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
const config = require('../server/config')
|
||||
const settingsController = require('./api/controller/settings')
|
||||
const log = require('../server/log')
|
||||
const db = require('./api/models/index')
|
||||
const dayjs = require('dayjs')
|
||||
const timezone = require('dayjs/plugin/timezone')
|
||||
|
||||
// export default async function () {
|
||||
module.exports = async function () {
|
||||
module.exports = function () {
|
||||
const config = require('../server/config')
|
||||
config.load()
|
||||
const log = require('../server/log')
|
||||
const settingsController = require('./api/controller/settings')
|
||||
const db = require('./api/models/index')
|
||||
const dayjs = require('dayjs')
|
||||
const timezone = require('dayjs/plugin/timezone')
|
||||
async function start (nuxt) {
|
||||
config.load()
|
||||
|
||||
if (config.status == 'READY') {
|
||||
await db.initialize()
|
||||
@@ -55,10 +54,5 @@ module.exports = async function () {
|
||||
process.on('SIGINT', shutdown)
|
||||
}
|
||||
|
||||
if (this.nuxt) {
|
||||
this.nuxt.hook('build:done', process.exit)
|
||||
return start(this.nuxt)
|
||||
} else {
|
||||
return start()
|
||||
}
|
||||
return start(this.nuxt)
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ const logger = createLogger({
|
||||
transports: process.env.NODE_ENV !== 'production'
|
||||
? [new transports.Console(
|
||||
{
|
||||
level: 'debug',
|
||||
level: config.log_level || 'debug',
|
||||
format: format.combine(format.splat(), format.timestamp(), format.colorize(), gancioFormat)
|
||||
}
|
||||
)]
|
||||
|
||||
Reference in New Issue
Block a user