-
Notifications
You must be signed in to change notification settings - Fork 20
/
config.js
308 lines (297 loc) · 10.3 KB
/
config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
/*
* Copyright 2022 Engineering Ingegneria Informatica S.p.A.
*
* This file is part of iotagent-opcua
*
* iotagent-opcua is free software: you can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the License,
* or (at your option) any later version.
*
* iotagent-opcua is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with iotagent-opcua.
* If not, see http://www.gnu.org/licenses/.
*
* For those usages not covered by the GNU Affero General Public License
* please contact with::[manfredi.pistone@eng.it, gabriele.deluca@eng.it, walterdomenico.vergara@eng.it, mattiagiuseppe.marzano@eng.it]
*/
const config = {};
config.iota = {
/**
* Configures the log level. Appropriate values are: FATAL, ERROR, INFO, WARN and DEBUG.
*/
logLevel: 'DEBUG',
/**
* When this flag is active, the IoTAgent will add the TimeInstant attribute to every entity created, as well
* as a TimeInstant metadata to each attribute, with the current timestamp.
*/
timestamp: true,
/**
* Context Broker configuration. Defines the connection information to the instance of the Context Broker where
* the IoT Agent will send the device data.
*/
contextBroker: {
/**
* Host where the Context Broker is located.
*/
host: 'localhost',
/**
* Port where the Context Broker is listening.
*/
port: '1026',
/**
* Version of the Context Broker (v2 or ld)
*/
ngsiVersion: 'v2',
/**
* JSON LD Context
*/
jsonLdContext: 'https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld',
/**
* Used as fallbackTenant
*/
service: 'opcua_car',
/**
* Used as fallbackPath
*/
subservice: '/demo'
},
/**
* Configuration of the North Port of the IoT Agent.
*/
server: {
/**
* Port where the IoT Agent will be listening for NGSI and Provisioning requests.
*/
port: 4041
},
/**
* Configuration for secured access to instances of the Context Broker secured with a PEP Proxy.
* For the authentication mechanism to work, the authentication attribute in the configuration has to be fully
* configured, and the authentication.enabled subattribute should have the value `true`.
*
* The Username and password should be considered as sensitive data and should not be stored in plaintext.
* Either encrypt the config and decrypt when initializing the instance or use environment variables secured by
* docker secrets.
*/
//authentication: {
//enabled: false,
/**
* Type of the Identity Manager which is used when authenticating the IoT Agent.
*/
//type: 'keystone',
/**
* Name of the additional header passed to hold the identity of the IoT Agent
*/
//header: 'X-Auth-Token',
/**
* Hostname of the Identity Manager.
*/
//host: 'localhost',
/**
* Port of the Identity Manager.
*/
//port: '5000',
/**
* Username for the IoT Agent - Note this should not be stored in plaintext.
*/
//user: 'IOTA_AUTH_USER',
/**
* Password for the IoT Agent - Note this should not be stored in plaintext.
*/
//password: 'IOTA_AUTH_PASSWORD',
/**
* OAuth2 client ID - Note this should not be stored in plaintext.
*/
//clientId: 'IOTA_AUTH_CLIENT_ID',
/**
* OAuth2 client secret - Note this should not be stored in plaintext.
*/
//clientSecret: 'IOTA_AUTH_CLIENT_SECRET'
//},
/**
* Defines the configuration for the Device Registry, where all the information about devices and configuration
* groups will be stored. There are currently just two types of registries allowed:
*
* - 'memory': transient memory-based repository for testing purposes. All the information in the repository is
* wiped out when the process is restarted.
*
* - 'mongodb': persistent MongoDB storage repository. All the details for the MongoDB configuration will be read
* from the 'mongodb' configuration property.
*/
deviceRegistry: {
type: 'mongodb'
},
/**
* Mongo DB configuration section. This section will only be used if the deviceRegistry property has the type
* 'mongodb'.
*/
mongodb: {
/**
* Host where MongoDB is located. If the MongoDB used is a replicaSet, this property will contain a
* comma-separated list of the instance names or IPs.
*/
host: 'localhost',
/**
* Port where MongoDB is listening. In the case of a replicaSet, all the instances are supposed to be listening
* in the same port.
*/
port: '27017',
/**
* Name of the Mongo database that will be created to store IoT Agent data.
*/
db: 'iotagent_opcua'
},
/**
* Types array for static configuration of services. Check documentation in the IoT Agent Library for Node.js for
* further details:
*
* https://github.com/Engineering-Research-and-Development/iotagent-opcua#type-configuration
*/
types: {},
contexts: [],
contextSubscriptions: [],
events: [],
/**
* Default service, for IoT Agent installations that won't require preregistration.
*/
service: 'opcua_car',
/**
* Default subservice, for IoT Agent installations that won't require preregistration.
*/
subservice: '/demo',
/**
* URL Where the IoT Agent Will listen for incoming updateContext and queryContext requests (for commands and
* passive attributes). This URL will be sent in the Context Registration requests.
*/
providerUrl: 'http://localhost:4041',
/**
* Default maximum expire date for device registrations.
*/
deviceRegistrationDuration: 'P20Y',
/**
* Default type, for IoT Agent installations that won't require preregistration.
*/
defaultType: 'Device',
/**
* Default resource of the IoT Agent. This value must be different for every IoT Agent connecting to the IoT
* Manager.
*/
defaultResource: '/iot/opcua',
/**
* Flag indicating whether the incoming measures to the IoTAgent should be processed as per the "attributes" field.
*/
explicitAttrs: false,
/**
* List of characters to be filtered before forwarding any request to Orion.
* Default Orion forbidden characters are filtered by default, see (https://github.com/telefonicaid/fiware-orion/blob/74aaae0c98fb24f082e3b258aa642461eb285e39/doc/manuals/orion-api.md#general-syntax-restrictions)
*/
extendedForbiddenCharacters: [],
/**
* Flag indicating whether to provision the Group and Device automatically
*/
autoprovision: true,
/**
* Default limit for express router built into iotagent-node-lib module
*/
expressLimit: '50mb'
};
config.opcua = {
/**
* Subscription options for OPC UA connection.
*/
subscription: {
maxNotificationsPerPublish: 1000,
publishingEnabled: true,
requestedLifetimeCount: 100,
requestedMaxKeepAliveCount: 10,
requestedPublishingInterval: 1000,
priority: 128
},
/**
* Endpoint where the IoT Agent will listen for an active OPC UA Server.
*/
endpoint: 'opc.tcp://localhost:5001/UA/CarServer',
/**
* Security Mode to access OPC UA Server.
*/
securityMode: 'None',
/**
* Security Policy to access OPC UA Server.
*/
securityPolicy: 'None',
/**
* Username to access OPC UA Server.
*/
username: null,
/**
* Password to access OPC UA Server.
*/
password: null,
/**
* Flag indicating whether the OPC uA variables readings should be handled as single subscription.
*/
uniqueSubscription: false
};
config.mappingTool = {
/**
* Boolean property to assess whether enabling polling in MappingTool or not
*/
polling: false,
/**
* agentId prefix to be assigned to the newly generated entity from MappingTool execution
*/
agentId: 'age01_',
/**
* Namespaces to ignore when crawling nodes from OPC UA Server
*/
namespaceIgnore: '0,7',
/**
* entityId to be assigned to the newly generated entity from MappingTool execution
*/
entityId: 'age01_Car',
/**
* entityType to be assigned to the newly generated entity from MappingTool execution
*/
entityType: 'Device',
/**
* boolean flag to determine whether to store the output of the mapping tool execution or not
*/
storeOutput: true
};
/**
* Flag indicating which configuration type to perform. Possible choices are:
* - auto : mappingTool will be run and runtime device mappings will be loaded
* - dynamic : device mappings from config.js will be ignored, REST API Provisioning is mandatory
* - static : device mappings from config.js will be loaded
*/
config.configurationType = 'auto';
/**
* map {name: function} of extra transformations avaliable at JEXL plugin
* see https://github.com/telefonicaid/iotagent-node-lib/tree/master/doc/expressionLanguage.md#available-functions
*/
config.jexlTransformations = {};
/**
* Flag indicating whether the incoming notifications to the IoTAgent should be processed using the bidirectionality
* plugin from the latest versions of the library or the OPCUA-specific configuration retrieval mechanism.
*/
config.configRetrieval = false;
/**
* Default API Key, to use with device that have been provisioned without a Configuration Group.
*/
config.defaultKey = 'iot';
/**
* Default transport protocol when no transport is provisioned through the Device Provisioning API.
*/
config.defaultTransport = 'OPCUA';
/**
* Flag indicating whether the node server will be executed in multi-core option (true) or it will be a
* single-thread one (false).
*/
//config.multiCore = false;
module.exports = config;