-
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
-
id
is the ID of the DGW, which must be unique in the deployment environment -
description
is a human-readable description for the DGW -
dnssdEnabled
is a flag enabling advertisement of DGW endpoint using DNS-SD (service type_pw-dgw._tcp
) -
publicAddr
is the FQDN or IP address of the DGW, which must be routable in the deployment environment -
staticDir
is the path to the directory with static files -
catalog
is an array of remote Device Catalogs. All registered devices will be published to each configured remote catalog (if not empty). -
discover
is the flag enabling automatic discovery of the Device Catalog using DNS-SD -
endpoint
is the URL of the remote Device Catalog API (http://address:port/path
) -
http
is the configuration of the built-in HTTP server -
bindAddr
is the bind address to listen on (0.0.0.0
to listen on all interfaces) -
bindPort
is the TCP port to listen on -
protocols
is a dictionary defining the configuration of the DGW API. At the moment,REST
andMQTT
protocols are supported (see API documentation for more details).
MQTT protocol:
-
url
is the broker URL in the formscheme://address:port
, wherescheme
is eithertcp
orssl
-
prefix
the topic prefix for all mqtt messages to/from devices registered on the DGW -
username
is the username for username/password authentication (for mosquitto broker see mosquito.conf) -
password
is the password for username/password authentication if used without ssl/tls trasmitted in plaintext -
caFile
is 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) -
certFile
is the path to the client certificate for certificate-based authentication of the client -
keyFile
is the path to the client private key for certificate-based authentication of the client
REST protocol:
-
location
is 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