mirror of
https://github.com/owntracks/recorder.git
synced 2026-02-13 20:49:51 +00:00
read OTR_TOPICS from environment (overrides config); can be overriden by argv
This commit is contained in:
6
misc.c
6
misc.c
@@ -197,8 +197,9 @@ void get_defaults(char *filename, struct udata *ud)
|
||||
|
||||
|
||||
/* Topics is a blank-separated string of words; split and add to JSON array */
|
||||
if (cf) {
|
||||
if ((v = c_str(cf, "OTR_TOPICS", NULL)) != NULL) {
|
||||
v = c_str(cf, "OTR_TOPICS", NULL);
|
||||
if (v && *v) {
|
||||
// if ((v = c_str(cf, "OTR_TOPICS", NULL)) != NULL) {
|
||||
char *parts[40];
|
||||
int np, n;
|
||||
if (ud->topics) json_delete(ud->topics);
|
||||
@@ -213,7 +214,6 @@ void get_defaults(char *filename, struct udata *ud)
|
||||
json_append_element(ud->topics, json_mkstring(parts[n]));
|
||||
}
|
||||
splitterfree(parts);
|
||||
}
|
||||
}
|
||||
#endif /* WITH_MQTT */
|
||||
|
||||
|
||||
@@ -1761,7 +1761,7 @@ int main(int argc, char **argv)
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if (argc >= 1) { /* topics on command line override config */
|
||||
if (argc >= 1) { /* topics on command line override config and environment */
|
||||
|
||||
/*
|
||||
* Push list of topics into the array so that we can
|
||||
|
||||
Reference in New Issue
Block a user