base: Fix a bug in database loader
/ deploy (push) Successful in -82h27m41s Details

nfp_moe: Trigger new release from above bug.
master nfp_moe_v2.1.6
Jonatan Nilsson 2023-11-05 21:36:40 +00:00
parent e5a1432443
commit f6d87c647f
2 changed files with 6 additions and 5 deletions

View File

@ -14,6 +14,7 @@ export default class Server {
this.http = http this.http = http
this.port = port this.port = port
this.core = core this.core = core
this.pool = null
this.flaskaOptions = { this.flaskaOptions = {
appendHeaders: { appendHeaders: {
@ -43,7 +44,7 @@ export default class Server {
this.flaska = new Flaska(this.flaskaOptions, this.http) this.flaska = new Flaska(this.flaskaOptions, this.http)
// Create our database pool // Create our database pool
let pool = this.runCreateDatabase() this.runCreateDatabase()
// configure our server // configure our server
if (config.get('NODE_ENV') === 'development') { if (config.get('NODE_ENV') === 'development') {
@ -56,8 +57,8 @@ export default class Server {
ctx.log = ctx.log.child({ ctx.log = ctx.log.child({
id: Math.random().toString(36).substring(2, 14), id: Math.random().toString(36).substring(2, 14),
}) })
ctx.db = pool ctx.db = this.pool
}) }.bind(this))
this.flaska.before(QueryHandler()) this.flaska.before(QueryHandler())
let healthChecks = 0 let healthChecks = 0
@ -109,7 +110,7 @@ export default class Server {
runCreateDatabase() { runCreateDatabase() {
return import('./db.mjs').then(db => { return import('./db.mjs').then(db => {
return db.initPool(this.core, config.get('mssql')) this.pool = db.initPool(this.core, config.get('mssql'))
}) })
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "nfp_moe", "name": "nfp_moe",
"version": "2.1.5", "version": "2.1.6",
"port": 4110, "port": 4110,
"description": "NFP Moe website", "description": "NFP Moe website",
"main": "index.js", "main": "index.js",