read OTR_TOPICS from environment (overrides config); can be overriden by argv

This commit is contained in:
Jan-Piet Mens
2022-09-07 14:14:01 +02:00
parent eb796d619c
commit 2198b5f279
2 changed files with 4 additions and 4 deletions

6
misc.c
View File

@@ -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 */

View File

@@ -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