Add configuration discovery helper method

Sensor configuration is passed to the application via the enviroment.
Create a map of environment values for a given sensor.

Change-Id: I8369eda27798fd9472166e898b8d6166c6997392
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/mainloop.cpp b/mainloop.cpp
index df85f26..a59fc1e 100644
--- a/mainloop.cpp
+++ b/mainloop.cpp
@@ -24,6 +24,7 @@
 #include "sysfs.hpp"
 #include "mainloop.hpp"
 #include "util.hpp"
+#include "env.hpp"
 
 using namespace std::literals::chrono_literals;
 
@@ -92,17 +93,10 @@
 
     for (auto& i : *sensors)
     {
+        // Get sensor configuration from the environment.
+
         // Ignore inputs without a label.
-        std::string envKey = "LABEL_" + i.first.first + i.first.second;
-        std::string label;
-
-        auto env = getenv(envKey.c_str());
-
-        if (env)
-        {
-            label.assign(env);
-        }
-
+        auto label = getEnv("LABEL", i.first);
         if (label.empty())
         {
             continue;