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