This repository was archived by the owner on Jul 5, 2022. It is now read-only.
Repository navigation
Configuration
Farshid Tavakolizadeh edited this page Jul 18, 2020
·
1 revision
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": "",
"description": "Example LinkSmart Device Gateway",
"publicEndpoint": "http://fqdn-of-the-host:8080",
"staticDir": "./static",
"catalog": [],
"http": {
"bindAddr": "0.0.0.0",
"bindPort": 8080
},
"protocols": {
"REST": {
"location": "/rest"
},
"MQTT": {
"discover": false,
"discoverID": "main_broker",
"url": "tcp://localhost:1883",
"prefix": "example-dgw",
"offlineBuffer": 100
}
},
"serviceCatalog": {
"endpoint": "http://localhost:8082",
"ttl": 120
}
}where
-
idis the ID of the DGW, which must be unique in the deployment environment. If not given, a UUID v4 will be generated. -
descriptionis a human-readable description for the DGW -
dnssdEnabledis a flag enabling advertisement of DGW endpoint using DNS-SD (service type_pw-dgw._tcp) -
publicEndpointis the URL of the gateway protocol://fqdn:port, which is in the deployment environment -
staticDiris the path to a directory for serving static files -
[deprecated] catalogis an array of remote Resource Catalogs. All registered devices will be published to each configured remote catalog (if not empty).-
discoveris the flag enabling automatic discovery of the Resource Catalog using DNS-SD -
endpointis the URL of the remote Resource 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.
REST protocol:
-
locationis the location (root) of the REST API for all devices registered on the DGW
MQTT protocol:
-
discoveris a flag enabling the discovery of broker endpoint from Service Catalog -
discoverIDis the the name of broker to be discovered. If not given, the first listed MQTT broker in Service Catalog will be retrieved. -
urlis the broker URL in the formscheme://address:port, whereschemeis eithertcporssl -
prefixis the default topic prefix for all mqtt messages to/from devices registered on the DGW, when the topic is not defined in device configurations. -
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 transmitted 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 -
offlineBufferis the size of the internal queue that holds messages while the client is temporarily offline (default=0)
Sample configuration file: device-gateway.json
The auth field configures the authentication for Device Gateway's built-in HTTP server:
"auth": {
"enabled": "boolean",
"provider": "string",
"providerURL": "string",
"serviceID": "string",
"basicEnabled": "bool",
"authorization": {}
}where
-
enabledis a boolean flag enabling/disabling the authentication -
provideris the name of a supported auth provider -
providerURLis the URL of the auth provider endpoint -
serviceIDis the ID of the service in the authentication provider (used for validating auth tokens provided by the clients) -
basicEnabledis a boolean flag enabling/disabling Basic Authentication -
authorization- optional, see authorization configuration
To publish the devices to an authenticated remote Resource Catalog, the auth field of that catalog should be set:
"catalog": [
{
"discover": "boolean",
"endpoint": "string",
"auth": {
"provider": "string",
"providerURL": "string",
"username": "string",
"password": "string",
"serviceID": "string"
}
}
]where
-
providerandproviderURLare the authentication configurations used by that Resource Catalog -
usernameandpasswordare the authentication credentials for accessing that Resource Catalog -
serviceIDis the ID of that Resource Catalog in the authentication provider