|
|
@ -29,6 +29,16 @@ global.syzoj = { |
|
|
|
if (obj instanceof ErrorMessage) return; |
|
|
|
if (obj instanceof ErrorMessage) return; |
|
|
|
console.log(obj); |
|
|
|
console.log(obj); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
checkMigratedToTypeORM() { |
|
|
|
|
|
|
|
const userConfig = require(options.config); |
|
|
|
|
|
|
|
if (!userConfig.db.migrated_to_typeorm) { |
|
|
|
|
|
|
|
app.use((req, res) => res.send('Please refer to <a href="https://github.com/syzoj/syzoj/wiki/TypeORM-%E8%BF%81%E7%A7%BB%E6%8C%87%E5%8D%97">TypeORM Migration Guide</a>.')); |
|
|
|
|
|
|
|
app.listen(parseInt(syzoj.config.port), syzoj.config.hostname); |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
}, |
|
|
|
async run() { |
|
|
|
async run() { |
|
|
|
// Check config
|
|
|
|
// Check config
|
|
|
|
if (syzoj.config.session_secret === '@SESSION_SECRET@' |
|
|
|
if (syzoj.config.session_secret === '@SESSION_SECRET@' |
|
|
@ -42,6 +52,8 @@ global.syzoj = { |
|
|
|
let Express = require('express'); |
|
|
|
let Express = require('express'); |
|
|
|
global.app = Express(); |
|
|
|
global.app = Express(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!this.checkMigratedToTypeORM()) return; |
|
|
|
|
|
|
|
|
|
|
|
syzoj.production = app.get('env') === 'production'; |
|
|
|
syzoj.production = app.get('env') === 'production'; |
|
|
|
let winstonLib = require('./libs/winston'); |
|
|
|
let winstonLib = require('./libs/winston'); |
|
|
|
winstonLib.configureWinston(!syzoj.production); |
|
|
|
winstonLib.configureWinston(!syzoj.production); |
|
|
|