mirror of
https://github.com/owntracks/recorder.git
synced 2026-08-27 16:57:21 +00:00
Support $OCAT_USERNAME $OCAT_DEVICE
This commit is contained in:
@@ -53,3 +53,5 @@ _ocat_ is a CLI driver for _recorder_: it prints data stored by the _recorder_ i
|
||||
The following environment variables control _ocat_'s behaviour:
|
||||
|
||||
* `OCAT_FORMAT` can be set to the preferred output format. If unset, JSON is used. The `--format` option overrides this setting.
|
||||
* `OCAT_USERNAME` can be set to the preferred username. The `--user` option overrides this environment variable.
|
||||
* `OCAT_DEVICE` can be set to the preferred device name. The `--device` option overrides this environment variable.
|
||||
|
||||
@@ -103,6 +103,13 @@ int main(int argc, char **argv)
|
||||
time_t now, s_lo, s_hi;
|
||||
output_type otype = JSON;
|
||||
|
||||
if ((p = getenv("OCAT_USERNAME")) != NULL) {
|
||||
username = strdup(p);
|
||||
}
|
||||
if ((p = getenv("OCAT_DEVICE")) != NULL) {
|
||||
device = strdup(p);
|
||||
}
|
||||
|
||||
if ((p = getenv("OCAT_FORMAT")) != NULL) {
|
||||
switch (tolower(*p)) {
|
||||
case 'j': otype = JSON; break;
|
||||
|
||||
Reference in New Issue
Block a user