Skip to content

Commit 9aa5e3c

Browse files
committed
added express limit env handling
1 parent 773b616 commit 9aa5e3c

File tree

10 files changed

+44
-10557
lines changed

10 files changed

+44
-10557
lines changed

conf/config-ld.example.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -371,13 +371,17 @@ config.iota = {
371371
*/
372372
defaultResource: '/iot/opcua',
373373
/**
374-
* flag indicating whether the incoming measures to the IoTAgent should be processed as per the "attributes" field.
374+
* Flag indicating whether the incoming measures to the IoTAgent should be processed as per the "attributes" field.
375375
*/
376376
explicitAttrs: false,
377377
/**
378378
* Flag indicating whether to provision the Group and Device automatically
379379
*/
380-
autoprovision: true
380+
autoprovision: true,
381+
/**
382+
* Default limit for express router built into iotagent-node-lib module
383+
*/
384+
expressLimit: '1M'
381385
};
382386

383387
config.opcua = {
@@ -440,7 +444,7 @@ config.mappingTool = {
440444
*/
441445
entityType: 'Device',
442446
/**
443-
* boolean flag to determine whether to store the output of the mapping tool execution or not
447+
* Boolean flag to determine whether to store the output of the mapping tool execution or not
444448
*/
445449
storeOutput: true,
446450
/**
@@ -458,7 +462,7 @@ config.mappingTool = {
458462
config.jexlTransformations = {};
459463

460464
/**
461-
* flag indicating whether the incoming notifications to the IoTAgent should be processed using the bidirectionality
465+
* Flag indicating whether the incoming notifications to the IoTAgent should be processed using the bidirectionality
462466
* plugin from the latest versions of the library or the OPCUA-specific configuration retrieval mechanism.
463467
*/
464468
config.configRetrieval = false;
@@ -471,7 +475,7 @@ config.defaultKey = 'iot';
471475
*/
472476
config.defaultTransport = 'OPCUA';
473477
/**
474-
* flag indicating whether the node server will be executed in multi-core option (true) or it will be a
478+
* Flag indicating whether the node server will be executed in multi-core option (true) or it will be a
475479
* single-thread one (false).
476480
*/
477481
//config.multiCore = false;

conf/config-v2.example.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ config.iota = {
371371
*/
372372
defaultResource: '/iot/opcua',
373373
/**
374-
* flag indicating whether the incoming measures to the IoTAgent should be processed as per the "attributes" field.
374+
* Flag indicating whether the incoming measures to the IoTAgent should be processed as per the "attributes" field.
375375
*/
376376
explicitAttrs: false,
377377
/**
@@ -382,7 +382,11 @@ config.iota = {
382382
/**
383383
* Flag indicating whether to provision the Group and Device automatically
384384
*/
385-
autoprovision: true
385+
autoprovision: true,
386+
/**
387+
* Default limit for express router built into iotagent-node-lib module
388+
*/
389+
expressLimit: '1M'
386390
};
387391

388392
config.opcua = {
@@ -458,7 +462,7 @@ config.mappingTool = {
458462
config.jexlTransformations = {};
459463

460464
/**
461-
* flag indicating whether the incoming notifications to the IoTAgent should be processed using the bidirectionality
465+
* Flag indicating whether the incoming notifications to the IoTAgent should be processed using the bidirectionality
462466
* plugin from the latest versions of the library or the OPCUA-specific configuration retrieval mechanism.
463467
*/
464468
config.configRetrieval = false;
@@ -471,7 +475,7 @@ config.defaultKey = 'iot';
471475
*/
472476
config.defaultTransport = 'OPCUA';
473477
/**
474-
* flag indicating whether the node server will be executed in multi-core option (true) or it will be a
478+
* Flag indicating whether the node server will be executed in multi-core option (true) or it will be a
475479
* single-thread one (false).
476480
*/
477481
//config.multiCore = false;

conf/config.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ config.iota = {
188188
*/
189189
defaultResource: '/iot/opcua',
190190
/**
191-
* flag indicating whether the incoming measures to the IoTAgent should be processed as per the "attributes" field.
191+
* Flag indicating whether the incoming measures to the IoTAgent should be processed as per the "attributes" field.
192192
*/
193193
explicitAttrs: false,
194194
/**
@@ -199,7 +199,11 @@ config.iota = {
199199
/**
200200
* Flag indicating whether to provision the Group and Device automatically
201201
*/
202-
autoprovision: true
202+
autoprovision: true,
203+
/**
204+
* Default limit for express router built into iotagent-node-lib module
205+
*/
206+
expressLimit: '1M'
203207
};
204208

205209
config.opcua = {
@@ -268,7 +272,7 @@ config.mappingTool = {
268272
};
269273

270274
/**
271-
* flag indicating which configuration type to perform. Possible choices are:
275+
* Flag indicating which configuration type to perform. Possible choices are:
272276
* - auto : mappingTool will be run and runtime device mappings will be loaded
273277
* - dynamic : device mappings from config.js will be ignored, REST API Provisioning is mandatory
274278
* - static : device mappings from config.js will be loaded
@@ -283,7 +287,7 @@ config.configurationType = 'auto';
283287
config.jexlTransformations = {};
284288

285289
/**
286-
* flag indicating whether the incoming notifications to the IoTAgent should be processed using the bidirectionality
290+
* Flag indicating whether the incoming notifications to the IoTAgent should be processed using the bidirectionality
287291
* plugin from the latest versions of the library or the OPCUA-specific configuration retrieval mechanism.
288292
*/
289293
config.configRetrieval = false;
@@ -296,7 +300,7 @@ config.defaultKey = 'iot';
296300
*/
297301
config.defaultTransport = 'OPCUA';
298302
/**
299-
* flag indicating whether the node server will be executed in multi-core option (true) or it will be a
303+
* Flag indicating whether the node server will be executed in multi-core option (true) or it will be a
300304
* single-thread one (false).
301305
*/
302306
//config.multiCore = false;

docker/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ services:
7272
- "IOTA_EXPLICITATTRS=true"
7373
- "IOTA_EXTENDED_FORBIDDEN_CHARACTERS=[]"
7474
- "IOTA_AUTOPROVISION=true"
75+
- "IOTA_EXPRESS_LIMIT=1M"
7576
- "IOTA_OPCUA_ENDPOINT=opc.tcp://iotcarsrv:5001/UA/CarServer"
7677
- "IOTA_OPCUA_SECURITY_MODE=None"
7778
- "IOTA_OPCUA_SECURITY_POLICY=None"
@@ -167,6 +168,7 @@ environment variables such as those shown below:
167168
- `IOTA_EXTENDED_FORBIDDEN_CHARACTERS` - List of characters to be filtered before forwarding any request to the
168169
Context Broker
169170
- `IOTA_AUTOPROVISION` - Flag indicating whether to provision the Group and Device automatically
171+
- `IOTA_EXPRESS_LIMIT` - Default limit for express router built into iotagent-node-lib module
170172
- `IOTA_OPCUA_ENDPOINT` - Endpoint of OPC UA Server
171173
- `IOTA_OPCUA_SECURITY_MODE` - Security mode for OPC UA connection
172174
- `IOTA_OPCUA_SECURITY_POLICY` - Security policy for OPC UA connection

docker/docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ services:
6464
- "IOTA_EXPLICITATTRS=true"
6565
- "IOTA_EXTENDED_FORBIDDEN_CHARACTERS=[]"
6666
- "IOTA_AUTOPROVISION=true"
67+
- "IOTA_EXPRESS_LIMIT=1M"
6768
- "IOTA_OPCUA_ENDPOINT=opc.tcp://iotcarsrv:5001/UA/CarServer"
6869
- "IOTA_OPCUA_SECURITY_MODE=None"
6970
- "IOTA_OPCUA_SECURITY_POLICY=None"

docs/opc_ua_agent_tutorial.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,7 @@ services:
506506
- "IOTA_EXPLICITATTRS=true"
507507
- "IOTA_EXTENDED_FORBIDDEN_CHARACTERS=[]"
508508
- "IOTA_AUTOPROVISION=true"
509+
- "IOTA_EXPRESS_LIMIT=1M"
509510
- "IOTA_OPCUA_ENDPOINT=opc.tcp://iotcarsrv:5001/UA/CarServer"
510511
- "IOTA_OPCUA_SECURITY_MODE=None"
511512
- "IOTA_OPCUA_SECURITY_POLICY=None"

lib/configService.js

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,9 @@
2222
*/
2323

2424
let config = {};
25-
const fs = require('fs');
2625
let logger = require('logops');
2726
const iotAgentLib = require('iotagent-node-lib');
2827

29-
function anyIsSet(variableSet) {
30-
for (let i = 0; i < variableSet.length; i++) {
31-
if (process.env[variableSet[i]]) {
32-
return true;
33-
}
34-
}
35-
36-
return false;
37-
}
38-
3928
function processEnvironmentVariables() {
4029
const commonVariables = ['CONFIGURATION_TYPE', 'CONFIG_RETRIEVAL', 'DEFAULT_KEY', 'DEFAULT_TRANSPORT'];
4130

@@ -61,7 +50,8 @@ function processEnvironmentVariables() {
6150
'IOTA_DEFAULTRESOURCE',
6251
'IOTA_EXPLICITATTRS',
6352
'IOTA_EXTENDED_FORBIDDEN_CHARACTERS',
64-
'IOTA_AUTOPROVISION'
53+
'IOTA_AUTOPROVISION',
54+
'IOTA_EXPRESS_LIMIT'
6555
];
6656

6757
const opcUAVariables = [
@@ -198,6 +188,10 @@ function processEnvironmentVariables() {
198188
config.iota.autoprovision = process.env.IOTA_AUTOPROVISION === 'true' ? true : false;
199189
}
200190

191+
if (process.env.IOTA_EXPRESS_LIMIT) {
192+
config.iota.expressLimit = process.env.IOTA_EXPRESS_LIMIT;
193+
}
194+
201195
opcUAVariables.forEach((key) => {
202196
let value = process.env[key];
203197
if (value) {

0 commit comments

Comments
 (0)