From dbc590f7a001d7f0d44c05848b26a9699a4dbc86 Mon Sep 17 00:00:00 2001 From: Kadir Goktas Date: Mon, 28 Oct 2019 09:31:07 +0300 Subject: [PATCH] fix: pass & parse shutdown opitons --- src/microservicekit.js | 2 +- src/shutdownkit.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/microservicekit.js b/src/microservicekit.js index 817729d..78542ba 100644 --- a/src/microservicekit.js +++ b/src/microservicekit.js @@ -19,8 +19,8 @@ class MicroserviceKit { init() { - if (!this.options_.amqp) { return Promise.resolve(); } this.shutdownKit.setoptions(this.options_.shutdown); + if (!this.options_.amqp) { return Promise.resolve(); } const amqpOptions = _.assign({}, this.options_.amqp, { id: this.getName() }); this.amqpKit = new AmqpKit(amqpOptions); return this.amqpKit.init(); diff --git a/src/shutdownkit.js b/src/shutdownkit.js index aa5c02d..1437f7c 100644 --- a/src/shutdownkit.js +++ b/src/shutdownkit.js @@ -21,7 +21,9 @@ class ShutdownKit { * @param opt_options */ setoptions(opt_options) { - this.options_ = Object.assign({}, this.defaultOptions_, _.pick(this.defaultOptions_, opt_options)); + const defaultKeys = _.keys(this.defaultOptions_); + const filteredOptions = _.pick(opt_options, defaultKeys) + this.options_ = Object.assign({}, this.defaultOptions_, filteredOptions); } /**