c109b6206c99261a2d1cfbc3cb13bac45e3c376d
[AGL/documentation.git] / docs / 4_APIs_and_Services / 4.3_Application_Framework_Binder / 6_Annexes / 4_Options_of_afb-daemon.md
1 ---
2 edit_link: ''
3 title: Options of afb-daemon
4 origin_url: >-
5   https://git.automotivelinux.org/src/app-framework-binder/plain/docs/afb-daemon-options.md?h=master
6 ---
7
8 <!-- WARNING: This file is generated by fetch_docs.js using /home/boron/Documents/AGL/docs-webtemplate/site/_data/tocs/apis_services/master/app-framework-binder-developer-guides-api-services-book.yml -->
9
10 # Launching options of afb-daemon
11
12 The launch options for binder **afb-daemon** are:
13
14 ```
15  -v, --verbose           Verbose Mode, repeat to increase verbosity
16  -c, --color             Colorize the ouput
17  -q, --quiet             Quiet Mode, repeat to decrease verbosity
18  -l, --log=xxxx          Tune log level
19      --foreground        Get all in foreground mode
20      --background        Get all in background mode
21  -D, --daemon            Get all in background mode
22  -n, --name=xxxx         Set the visible name
23  -p, --port=xxxx         HTTP listening TCP port  [default 1234]
24      --roothttp=xxxx     HTTP Root Directory [default no root http (files not served but apis still available)]
25      --rootbase=xxxx     Angular Base Root URL [default /opa]
26      --rootapi=xxxx      HTML Root API URL [default /api]
27      --alias=xxxx        Multiple url map outside of rootdir [eg: --alias=/icons:/usr/share/icons]
28      --apitimeout=xxxx   Binding API timeout in seconds [default 20]
29      --cntxtimeout=xxxx  Client Session Context Timeout [default 32000000]
30      --cache-eol=xxxx    Client cache end of live [default 100000]
31  -w, --workdir=xxxx      Set the working directory [default: $PWD or current working directory]
32  -u, --uploaddir=xxxx    Directory for uploading files [default: workdir] relative to workdir
33      --rootdir=xxxx      Root Directory of the application [default: workdir] relative to workdir
34      --ldpaths=xxxx      Load bindings from dir1:dir2:... [default: path of afb-dbus-binding.so]
35  -b, --binding=xxxx      Load the binding of path
36      --weak-ldpaths=xxxx Same as --ldpaths but ignore errors
37      --no-ldpaths        Discard default ldpaths loading
38  -t, --token=xxxx        Initial Secret [default=random, use --token= to allow any token]
39  -r, --random-token      Enforce a random token
40  -V, --version           Display version and copyright
41  -h, --help              Display this help
42      --ws-client=xxxx    Bind to an afb service through websocket
43      --ws-server=xxxx    Provide an afb service through websockets
44  -A, --auto-api=xxxx     Automatic load of api of the given directory
45      --session-max=xxxx  Max count of session simultaneously [default 200]
46      --tracereq=xxxx     Log the requests: no, common, extra, all
47      --traceevt=xxxx     Log the events: no, common, extra, all
48      --traceses=xxxx     Log the sessions: no, all
49      --traceapi=xxxx     Log the apis: no, common, api, event, all
50      --traceglob=xxxx    Log the globals: none, all
51      --traceditf=xxxx    Log the daemons: no, common, all
52      --tracesvc=xxxx     Log the services: no, all
53      --call=xxxx         call at start, format of val: API/VERB:json-args
54      --no-httpd          Forbid HTTP service
55  -e, --exec              Execute the remaining arguments
56  -M, --monitoring        Enable HTTP monitoring at <ROOT>/monitoring/
57  -C, --config=xxxx       Load options from the given config file
58  -Z, --dump-config       Dump the config to stdout and exit
59  -s, --set=xxxx          Set parameters ([API]/[KEY]:JSON or {"API":{"KEY":JSON}}
60  -o, --output=xxxx       Redirect stdout and stderr to output file (when --daemon)
61      --trap-faults=xxxx  Trap faults: on, off, yes, no, true, false, 1, 0 (default: true)
62 ```
63
64 ## help
65
66 Prints help with available options
67
68 ## version
69
70 Display version and copyright
71
72 ## verbose
73
74 Increases the verbosity, can be repeated
75
76 ## color
77
78 Add basic colorization to the ouput.
79
80 ## quiet
81
82 Decreases the verbosity, can be repeated
83
84 ## log=xxxx
85
86 Tune the log level mask. The levels are:
87
88  - error
89  - warning
90  - notice
91  - info
92  - debug
93
94 The level can be set using + or -.
95
96 | Examples | descritpion
97 |-----------------|-------------------
98 | error,warning   | selects only the levels error and warning
99 | +debug          | adds level debug to the current verbosity
100 | -warning        | remove the level warning from the current verbosity
101 | +warning-debug,info | Adds error and remove errors and warnings
102
103 ## port=xxxx
104
105 HTTP listening TCP port  [default 1234]
106
107 ## workdir=xxxx
108
109 Directory where the daemon must run [default: $PWD if defined
110 or the current working directory]
111
112 ## uploaddir=xxxx
113
114 Directory where uploaded files are temporarily stored [default: workdir]
115
116 ## rootdir=xxxx
117
118 Root directory of the application to serve [default: workdir]
119
120 ## roothttp=xxxx
121
122 Directory of HTTP served files. If not set, files are not served
123 but apis are still accessible.
124
125 ## rootbase=xxxx
126
127 Angular Base Root URL [default /opa]
128
129 This is used for any application of kind OPA (one page application).
130 When set, any missing document whose url has the form /opa/zzz
131 is translated to /opa/#!zzz
132
133 ## rootapi=xxxx
134
135 HTML Root API URL [default /api]
136
137 The bindings are available within that url.
138
139 ## alias=xxxx
140
141 Maps a path located anywhere in the file system to the
142 a subdirectory. The syntax for mapping a PATH to the
143 subdirectory NAME is: --alias=/NAME:PATH.
144
145 Example: --alias=/icons:/usr/share/icons maps the
146 content of /usr/share/icons within the subpath /icons.
147
148 This option can be repeated.
149
150 ## apitimeout=xxxx
151
152 binding API timeout in seconds [default 20]
153
154 Defines how many seconds maximum a method is allowed to run.
155 0 means no limit.
156
157 ## cntxtimeout=xxxx
158
159 Client Session Timeout in seconds [default 32000000 that is 1 year]
160
161 ## cache-eol=xxxx
162
163 Client cache end of live [default 100000 that is 27,7 hours]
164
165 ## session-max=xxxx
166
167 Maximum count of simultaneous sessions [default 200]
168
169 ## ldpaths=xxxx
170
171 Load bindings from given paths separated by colons
172 as for dir1:dir2:binding1.so:... [default = $libdir/afb]
173
174 You can mix path to directories and to bindings.
175 The sub-directories of the given directories are searched
176 recursively.
177
178 The bindings are the files terminated by '.so' (the extension
179 so denotes shared object) that contain the public entry symbol.
180
181 ## weak-ldpaths=xxxx
182
183 Same as --ldpaths but instead of stopping on error, ignore errors and continue.
184
185 ## binding=xxxx
186
187 Load the binding of given path.
188
189 ## token=xxxx
190
191 Initial Secret token to authenticate.
192
193 If not set, no client can authenticate.
194
195 If set to the empty string, then any initial token is accepted.
196
197 ## random-token
198
199 Generate a random starting token. See option --exec.
200
201 ## ws-client=xxxx
202
203 Transparent binding to a binder afb-daemon service through a WebSocket.
204
205 The value of xxxx is either a unix naming socket, of the form "unix:path/api",
206 or an internet socket, of the form "host:port/api".
207
208 ## ws-server=xxxx
209
210 Provides a binder afb-daemon service through WebSocket.
211
212 The value of xxxx is either a unix naming socket, of the form "unix:path/api",
213 or an internet socket, of the form "host:port/api".
214
215 ## foreground
216
217 Get all in foreground mode (default)
218
219 ## daemon
220
221 Get all in background mode
222
223 ## no-httpd
224
225 Forbids HTTP serve
226
227 ## exec
228
229 Must be the last option for afb-daemon. The remaining
230 arguments define a command that afb-daemon will launch.
231 The sequences @p, @t and @@ of the arguments are replaced
232 with the port, the token and @.
233
234 ## tracereq=xxxx
235
236 Trace the processing of requests in the log file.
237
238 Valid values are 'no' (default), 'common', 'extra' or 'all'.
239
240 ## traceapi=xxxx
241
242 Trace the accesses to functions of class api.
243
244 Valid values are 'no' (default), 'common', 'api', 'event' or 'all'.
245
246 ## traceevt=xxxx
247
248 Trace the accesses to functions of class event.
249
250 Valid values are 'no' (default), 'common', 'extra' or 'all'.
251
252 ## call=xxx
253
254 Call a binding at start (can be be repeated).
255 The values are given in the form API/VERB:json-args.
256
257 Example: --call 'monitor/set:{"verbosity":{"api":"debug"}}'
258
259 ## monitoring
260
261 Enable HTTP monitoring at <ROOT>/monitoring/
262
263 ## name=xxxx
264
265 Set the visible name
266
267 ## auto-api=xxxx
268
269 Automatic activation of api of the given directory when the api is missing.
270
271 ## config=xxxx
272
273 Load options from the given config file
274
275 This can be used instead of arguments on the command line.
276
277 Example:
278
279         afb-daemon \
280                 --no-ldpaths \
281                 --binding /home/15646/bindings/binding45.so \
282                 --binding /home/15646/bindings/binding3.so \
283                 --tracereq common \
284                 --port 5555 \
285                 --token SPYER \
286                 --set api45/key:54027a5e3c6cb2ca5ddb97679ce32f185b067b0a557d16a8333758910bc25a72 \
287                 --exec /home/15646/bin/test654 @p @t
288
289 is equivalent to:
290
291         afb-daemon --config /home/15646/config1
292
293 when the file **/home/15646/config1** is:
294
295         {
296           "no-ldpaths": true,
297           "binding": [
298             "\/home\/15646\/bindings\/binding45.so",
299             "\/home\/15646\/bindings\/binding3.so"
300           ],
301           "tracereq": "common",
302           "port": 5555,
303           "token": "SPYER",
304           "set" : {
305             "api45": {
306               "key": "54027a5e3c6cb2ca5ddb97679ce32f185b067b0a557d16a8333758910bc25a72"
307             }
308           },
309           "exec": [
310             "\/home\/15646\/bin\/test654",
311             "@p",
312             "@t"
313           ]
314         }
315
316 The options are the keys of the config object.
317
318 See option --dump-config
319
320 ## dump-config
321
322 Output a JSON representation of the configuration resulting from
323 environment and options.
324
325 ## output=xxxx
326
327 Redirect stdout and stderr to output file
328
329 ## set=xxxx
330
331 Set values that can be retrieved by bindings.
332
333 The set value can have different formats.
334
335 The most generic format is **{"API1":{"KEY1":VALUE,"KEY2":VALUE2,...},"API2":...}**
336
337 This example set 2 keys for the api *chook*:
338
339         afb-daemon -Z --set '{"chook":{"account":"urn:chook:b2ca5ddb97679","delay":500}}'
340         {
341            "set": {
342              "chook": {
343                "account": "urn:chook:b2ca5ddb97679",
344                "delay": 500
345              }
346            }
347          }
348
349 An other format is: **[API]/[KEY]:VALUE**.
350 When API is omitted, it take the value "*".
351 When KEY is ommitted, it take the value of "*".
352
353 The settings for the API \* are globals and apply to all bindings.
354
355 The settings for the KEY \* are mixing the value for the API.
356
357 The following examples are all setting the same values:
358
359         afb-daemon --set '{"chook":{"account":"urn:chook:b2ca5ddb97679","delay":500}}'
360         afb-daemon --set 'chook/*:{"account":"urn:chook:b2ca5ddb97679","delay":500}'
361         afb-daemon --set 'chook/:{"account":"urn:chook:b2ca5ddb97679","delay":500}'
362         afb-daemon --set 'chook/account:"urn:chook:b2ca5ddb97679"' --set chook/delay:500
363