application: Expose app config in ctx.config
All checks were successful
continuous-integration/appveyor/branch AppVeyor build succeeded

This commit is contained in:
Jonatan Nilsson 2022-04-02 20:10:09 +00:00
parent 618cfd0451
commit 33b3d98a37
3 changed files with 4 additions and 1 deletions

View file

@ -55,6 +55,8 @@ export default class Application extends EventEmitter {
this.config.heartbeatPath = this.config.heartbeatPath || '/'
this.config.clusterWaitOnCrash = this.config.clusterWaitOnCrash || (1 * 1000)
this.ctx.config = this.config
Object.assign(this, {
setInterval: opts.setInterval || setInterval,
setTimeout: opts.setTimeout || setTimeout,

View file

@ -1,6 +1,6 @@
{
"name": "service-core",
"version": "3.0.0-beta.15",
"version": "3.0.0-beta.16",
"description": "Core boiler plate code to install node server as windows service",
"main": "index.mjs",
"scripts": {

View file

@ -65,6 +65,7 @@ t.describe('constructor()', function() {
assert.strictEqual(app.config.clusterWaitOnCrash, 1 * 1000)
assert.strictEqual(app.ctx.db, ctx.db)
assert.strictEqual(app.ctx.app, app)
assert.strictEqual(app.ctx.config, app.config)
assert.strictEqual(app.ctx.util, ctx.util)
assert.strictEqual(app.ctx.sc.Util, Util)
assert.strictEqual(app.ctx.sc.bunyan, bunyan)