diff --git a/docs/installationguide.md b/docs/installationguide.md index cd860f73..83f2b35f 100644 --- a/docs/installationguide.md +++ b/docs/installationguide.md @@ -202,7 +202,7 @@ The ones relating specific JSON bindings are described in the following table. | IOTA_MQTT_AVOID_LEADING_SLASH | mqtt.avoidLeadingSlash | | IOTA_MQTT_CLEAN | mqtt.clean | | IOTA_MQTT_CLIENT_ID | mqtt.clientId | -| IOTA_MQTT_DISABLED | | +| IOTA_MQTT_DISABLED | mqtt.disabled | | IOTA_AMQP_HOST | amqp.host | | IOTA_AMQP_PORT | amqp.port | | IOTA_AMQP_USERNAME | amqp.username | @@ -212,7 +212,7 @@ The ones relating specific JSON bindings are described in the following table. | IOTA_AMQP_DURABLE | amqp.durable | | IOTA_AMQP_RETRIES | amqp.retries | | IOTA_AMQP_RETRY_TIME | amqp.retryTime | -| IOTA_AMQP_DISABLED | | +| IOTA_AMQP_DISABLED | amqp.disabled | | IOTA_HTTP_HOST | http.host | | IOTA_HTTP_PORT | http.port | | IOTA_HTTP_TIMEOUT | http.timeout | diff --git a/lib/bindings/AMQPBinding.js b/lib/bindings/AMQPBinding.js index b50dcb93..fa991055 100644 --- a/lib/bindings/AMQPBinding.js +++ b/lib/bindings/AMQPBinding.js @@ -74,6 +74,9 @@ function start(callback) { if (!amqpConfig) { return config.getLogger().error(context, 'Error AMPQ is not configured'); } + if (amqpConfig.disabled) { + return config.getLogger().error(context, 'AMPQ is disabled'); + } if (amqpConfig.exchange) { exchange = amqpConfig.exchange; diff --git a/lib/bindings/MQTTBinding.js b/lib/bindings/MQTTBinding.js index dec3953b..399efde6 100644 --- a/lib/bindings/MQTTBinding.js +++ b/lib/bindings/MQTTBinding.js @@ -232,6 +232,9 @@ function start(callback) { if (!mqttConfig) { return config.getLogger().error(context, 'Error MQTT is not configured'); } + if (mqttConfig.disabled) { + return config.getLogger().error(context, 'MQTT is disabled'); + } const rejectUnauthorized = typeof mqttConfig.rejectUnauthorized === 'boolean' ? mqttConfig.rejectUnauthorized : true; let rndSuffix = '_' + Math.random().toString(16).substr(2, 8); diff --git a/lib/configService.js b/lib/configService.js index 8cb93f6f..6efd87b3 100644 --- a/lib/configService.js +++ b/lib/configService.js @@ -228,7 +228,7 @@ function processEnvironmentVariables() { } if (process.env.IOTA_MQTT_DISABLED && process.env.IOTA_MQTT_DISABLED.trim().toLowerCase() === 'true'){ - delete config.mqtt; + config.mqtt.disabled = true; } if (anyIsSet(amqpVariables)) { @@ -273,7 +273,7 @@ function processEnvironmentVariables() { } if (process.env.IOTA_AMPQ_DISABLED && process.env.IOTA_AMPQ_DISABLED.trim().toLowerCase() === 'true'){ - delete config.amqp; + config.amqp.disabled = true; } if (anyIsSet(httpVariables)) {