-
Notifications
You must be signed in to change notification settings - Fork 5
Configuring Device Gateway
Alexandr Krylovskiy edited this page Nov 7, 2014
·
13 revisions
Device Gateway is configured using a JSON configuration file, path to which is provided to the DGW via -conf flag.
The default configuration file (provided in the binary distribution) is located at
conf/device-gateway.json
The DGW configuration file has the following format:
{
"id": <string>,
"description": <string>,
"dnssdEnabled": <bool>,
"publicAddr": <string>,
"staticDir": <string>,
"catalog": [
{
"discover": <bool>,
"endpoint": <string>
}
],
"http": {
"bindAddr": <string>,
"bindPort": <int>
},
"protocols": {
"REST": {
"location": <int>
},
"MQTT": {
"url": <string>,
"prefix": <string>,
"username": "<string>",
"password": "<string>",
"caFile": "<string>",
"certFile": "<string>",
"keyFile": "<string>"
}
}
}Where
-
idis the ID of the DGW, which must be unique in the deployment environment -
descriptionis a human-readable description for the DGW -
dnssdEnabledis a flag enabling advertisement of DGW endpoint using DNS-SD (service type_pw-dgw._tcp) -
publicAddris the FQDN or IP address of the DGW, which must be routable in the deployment environment -
staticDiris the path to the directory with static files -
catalogis an array of remote Device Catalogs. All registered devices will be published to each configured remote catalog (if not empty). -
discoveris the flag enabling automatic discovery of the Device Catalog using DNS-SD -
endpointis the URL of the remote Device Catalog API (http://address:port/path) -
httpis the configuration of the built-in HTTP server -
bindAddris the bind address to listen on (0.0.0.0to listen on all interfaces) -
bindPortis the TCP port to listen on -
protocolsis a dictionary defining the configuration of the DGW API. At the moment,RESTandMQTTprotocols are supported (see API documentation for more details).
MQTT protocol:
-
urlis the broker URL in the formscheme://address:port, whereschemeis eithertcporssl -
prefixthe topic prefix for all mqtt messages to/from devices registered on the DGW -
usernameis the username for username/password authentication (for mosquitto broker see mosquito.conf) -
passwordis the password for username/password authentication if used without ssl/tls trasmitted in plaintext -
caFileis the path to the CA certificate for SSL/TLS authentication of the message broker with a self-signed certificate (for mosquitto broker see mosquitto-tls) -
certFileis the path to the client certificate for certificate-based authentication of the client -
keyFileis the path to the client private key for certificate-based authentication of the client
REST protocol:
-
locationis the location (root) of the REST API for all devices registered on the DGW
The default configuration file (provided in the binary distribution) is the following:
{
"id": "some-unique-name-here-like-hostname-or-fqdn",
"description": "Example Gateway",
"dnssdEnabled": false,
"publicAddr": "fqdn-of-the-host",
"staticDir": "./static",
"catalog": [
{
"discover": false,
"endpoint": "http://remotehost:8080/dc"
}
],
"http": {
"bindAddr": "0.0.0.0",
"bindPort": 8080
},
"protocols": {
"REST": {
"location": "/rest"
},
"MQTT": {
"url": "127.0.0.1:1883",
"prefix": "/some-unique-name-or-id-from-this-config"
}
}
}About Patchwork Toolkit
Configuration
- Configuring Device Gateway
- Configuring Devices
- Configuring Device Catalog
- Configuring Service Catalog
- Configuring Services
Deployment examples
- Singleall-in-on-box
- Multiple Device Gateways with optional central Device Catalog
- Using central Service Catalog
API for Application developers
Integrating devices
- TBD...
Third-party integrations