From 536d1bbdf741e19d30735d4e647014bbad0b5a18 Mon Sep 17 00:00:00 2001 From: Jan-Piet Mens Date: Tue, 11 Oct 2016 19:48:34 +0200 Subject: [PATCH] add support fro $OTR_BROWSERAPIKEY from environment closes #156 --- README.md | 2 +- recorder.c | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c8c5008..1354418 100644 --- a/README.md +++ b/README.md @@ -277,7 +277,7 @@ The following configuration settings may be applied (a `Y` in column `$` means a | `OTR_LUASCRIPT` | | | Path to the Lua script | `OTR_PRECISION` | | `7` | Reverse-geo precision | `OTR_GEOKEY` | | | API key for reverse-geo lookups -| `OTR_BROWSERAPIKEY` | | | Google maps browser API key +| `OTR_BROWSERAPIKEY` | Y | | Google maps browser API key | `OTR_TOPICS` | | | String containing a space-separated list of topics to subscribe to for MQTT (overridden by command-line arguments) | `OTR_CAFILE` | Y | | Path to PEM-encoded CA certificate file for MQTT (implicitly enables TLS) diff --git a/recorder.c b/recorder.c index c6564a1..59ed26f 100644 --- a/recorder.c +++ b/recorder.c @@ -1278,6 +1278,11 @@ int main(int argc, char **argv) } #endif + if ((p = getenv("OTR_BROWSERAPIKEY")) != NULL) { + if (ud->browser_apikey) + free(ud->browser_apikey); + ud->browser_apikey = strdup(p); + } while (1) { static struct option long_options[] = {