-
Notifications
You must be signed in to change notification settings - Fork 4
Configuration
LinkSmart Thing Directory is configured using a JSON configuration file, path to which is provided via --conf flag. By default, the server looks for a configuration file at: conf/thing-directory.json
All configuration fields (except for arrays of objects) can be overridden using environment variables. Below are few examples:
TD_HTTP_BINDPORT=8081TD_STORAGE_TYPE=leveldbTD_VALIDATION_JSONSCHEMAS="conf/wot_td_schema.json,conf/wot_discovery_schema.json"- ❌ TD_AUTH_AUTHORIZATION_RULES --> setting array of objects is not possible with env var
For additional usage guides on passing configuration arguments using environment variables, see envconfig.
A sample configuration file is available at thing-directory.json.
where
-
descriptionis a human-readable description for the TD -
validation-
jsonSchemasis an array of paths to JSON Schema files used for input validation; see validation
-
-
storageis the configuration of the storage backend-
typeis the type of the backend (i.e. currently onlyleveldb) -
dsnis the Data Source Name for storage backend (forleveldb, the dsn may be relative or absolute directory path)
-
-
dnssdis the configuration of DNS-SD-
publishis the configuration of the DNS-SD publisher. The service type is_wot._tcp, subtype is_directory.-
enabledis a boolean flag to enable the DNS-SD service registration -
instanceis the instance portion of the Service Instance Name -
domainis the domain portion of the Service Instance Name -
interfacesis to limit the networking interfaces on which the service is announced. When empty, the service is announced to all interfaces.
-
-
-
serviceCatalogis the optional server information for a Service Catalog-
discoveris a flag to enable automatic discovery of the Service Catalog -
endpointis the URL of the Service Catalog HTTP API -
ttlis the TTL for the service registration
-
-
httpis the configuration of the HTTP server-
publicEndpointis the fully qualified domain name (FQDN) -
bindAddris the HTTP bind address which the server listens on -
bindPortis the HTTP bind port-
authis the Authentication configuration-
enabledis a boolean flag to enable the authentication -
provideris the name of a supported auth provider (i.e. currently onlykeycloak) -
providerURLis the URL of the auth provider endpoint -
clientIDis the ID of the client in the authentication provider -
basicEnabledis a boolean flag to enable Basic Authentication. This allows the server to exchange credentials (provided as basic auth header) with the authentication provider for a token on behalf of the user. Note: This should be enabled only if the requests are served over TLS. More info. -
authorization- optional, see authorization configuration
-
-
-
By default, the inputs are not validated. Validation can be done using one or more JSON Schema documents. To enable validation, the path to locally available JSON Schema files should be set in server configuration.
E.g. download WoT TD and Discovery validation files:
curl https://raw.githubusercontent.com/w3c/wot-thing-description/REC1.0/validation/td-json-schema-validation.json --create-dirs -o conf/wot_td_schema.json
curl https://raw.githubusercontent.com/w3c/wot-discovery/main/validation/td-discovery-extensions-json-schema.json --create-dirs -o conf/wot_discovery_schema.jsonPass the file paths to server either in configuration file:
"validation": {
"jsonSchemas": ["conf/wot_td_schema.json", "conf/wot_discovery_schema.json"]
},or as an environment variable:
TD_VALIDATION_JSONSCHEMAS="conf/wot_td_schema.json,conf/wot_discovery_schema.json"