Skip to content

Commit 9a2f461

Browse files
committed
docs(cli/README): allign the help message with the latest changes
1 parent 876bede commit 9a2f461

2 files changed

Lines changed: 29 additions & 64 deletions

File tree

packages/cli/README.md

Lines changed: 28 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -56,79 +56,44 @@ The `-h` option explains the functionality and also how node-wot can be configur
5656
The `-h` help option shows the following output:
5757

5858
```
59-
Usage: wot-servient [options] [files...]
59+
Usage: wot-servient [options] [command] [files...]
6060
6161
6262
Run a WoT Servient in the current directory.
6363
6464
6565
Arguments:
66-
files script files to execute. If no script is given, all .js files in the current directory are
67-
loaded. If one or more script is given, these files are loaded instead of the directory.
66+
files script files to execute. If no script is given, all .js files in the current directory are loaded. If one or more script is given, these files are loaded instead of the directory.
6867
6968
Options:
70-
-v, --version display node-wot version
71-
-i, --inspect [host]:[port] activate inspector on host:port (default: 127.0.0.1:9229)
72-
-ib, --inspect-brk [host]:[port] activate inspector on host:port (default: 127.0.0.1:9229)
73-
-c, --client-only do not start any servers (enables multiple instances without port conflicts)
74-
-cp, --compiler <module> load module as a compiler
75-
-f, --config-file <file> load configuration from specified file (default: "wot-servient.conf.json")
76-
-p, --config-params <param...> override configuration parameters [key1:=value1 key2:=value2 ...] (e.g. http.port:=8080)
77-
-h, --help show this help
78-
79-
wot-servient.conf.json syntax:
69+
-v, --version display node-wot version
70+
-c, --client-only do not start any servers (enables multiple instances without port conflicts)
71+
-ll, --logLevel <string> choose the desired log level. WARNING: if DEBUG env variable is specified this option gets overridden. (choices: "debug", "info", "warn", "error")
72+
-f, --config-file <file> load configuration from specified file (default: $(pwd)/wot-servient.conf.json
73+
-p, --config-params <param...> override configuration parameters [key1:=value1 key2:=value2 ...] (e.g. http.port:=8080)
74+
-h, --help show this help
75+
76+
Commands:
77+
schema prints the json schema for the configuration file
78+
79+
Configuration
80+
81+
Settings can be applied through three methods, in order of precedence (highest to lowest):
82+
83+
1. Command-Line Parameters (-p path.to.set=value)
84+
2. Environment Variables (NODE_WOT_PATH_TO_SET=value) (supports .env files too)
85+
3. Configuration File
86+
87+
For the complete list of available configuration fields and their data types, run:
88+
89+
wot-servient schema
90+
91+
In your configuration files you can the following to enable IDE config validation:
92+
8093
{
81-
"servient": {
82-
"clientOnly": CLIENTONLY,
83-
"staticAddress": STATIC,
84-
"scriptAction": RUNSCRIPT
85-
},
86-
"http": {
87-
"port": HPORT,
88-
"proxy": PROXY,
89-
"allowSelfSigned": ALLOW
90-
},
91-
"mqtt" : {
92-
"broker": BROKER-URL,
93-
"username": BROKER-USERNAME,
94-
"password": BROKER-PASSWORD,
95-
"clientId": BROKER-UNIQUEID,
96-
"protocolVersion": MQTT_VERSION
97-
},
98-
"credentials": {
99-
THING_ID1: {
100-
"token": TOKEN
101-
},
102-
THING_ID2: {
103-
"username": USERNAME,
104-
"password": PASSWORD
105-
}
106-
}
94+
"$schema": "./node_modules/@node-wot/cli/dist/wot-servient-schema.conf.json"
95+
...
10796
}
108-
109-
wot-servient.conf.json fields:
110-
CLIENTONLY : boolean setting if no servers shall be started (default=false)
111-
STATIC : string with hostname or IP literal for static address config
112-
RUNSCRIPT : boolean to activate the 'runScript' Action (default=false)
113-
HPORT : integer defining the HTTP listening port
114-
PROXY : object with "href" field for the proxy URI,
115-
"scheme" field for either "basic" or "bearer", and
116-
corresponding credential fields as defined below
117-
ALLOW : boolean whether self-signed certificates should be allowed
118-
BROKER-URL : URL to an MQTT broker that publisher and subscribers will use
119-
BROKER-UNIQUEID : unique id set by MQTT client while connecting to the broker
120-
MQTT_VERSION : number indicating the MQTT protocol version to be used (3, 4, or 5)
121-
THING_IDx : string with TD "id" for which credentials should be configured
122-
TOKEN : string for providing a Bearer token
123-
USERNAME : string for providing a Basic Auth username
124-
PASSWORD : string for providing a Basic Auth password
125-
---------------------------------------------------------------------------
126-
127-
Environment variables must be provided in a .env file in the current working directory.
128-
129-
Example:
130-
VAR1=Value1
131-
VAR2=Value2
13297
```
13398

13499
Additionally, you can look at [the JSON Schema](https://github.com/eclipse-thingweb/node-wot/blob/master/packages/cli/src/wot-servient-schema.conf.json) to understand possible values for each field.

packages/cli/src/cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ program
8686
)
8787
.option(
8888
"-f, --config-file <file>",
89-
"load configuration from specified file (default: $(pwd)/wot-servient.conf.json",
89+
"load configuration from specified file (default: $(pwd)/wot-servient.conf.json)",
9090
(value, previous) => parseConfigFile(value, previous)
9191
)
9292
.option(

0 commit comments

Comments
 (0)