psu: Add command line argument for JSON config file

Allow for a -c/--config argument to pass in full path to a JSON
configuration file. This argument is optional, if not specified, load
the JSON configuration file from:
/etc/phosphor-psu-monitor/psu_config.json.

Change-Id: I94856c23b09eff32039a1cd26ff35f6f354ea3d4
Signed-off-by: Brandon Wyman <bjwyman@gmail.com>
diff --git a/phosphor-power-supply/main.cpp b/phosphor-power-supply/main.cpp
index e2c2a62..bbbd459 100644
--- a/phosphor-power-supply/main.cpp
+++ b/phosphor-power-supply/main.cpp
@@ -14,16 +14,33 @@
  * limitations under the License.
  */
 #include <CLI/CLI.hpp>
+#include <phosphor-logging/log.hpp>
+
+#include <filesystem>
 
 int main(int argc, char* argv[])
 {
-    auto rc = -1;
+    using namespace phosphor::logging;
 
     CLI::App app{"OpenBMC Power Supply Unit Monitor"};
+
+    std::string configfile;
+    app.add_option("-c,--config", configfile, "JSON configuration file path")
+        ->check(CLI::ExistingFile);
+
     // Read the arguments.
     CLI11_PARSE(app, argc, argv);
+    if (configfile.empty())
+    {
+        configfile = "/etc/phosphor-psu-monitor/psu_config.json";
+    }
 
-    rc = 0;
+    if (!std::filesystem::exists(configfile))
+    {
+        log<level::ERR>("Configuration file does not exist",
+                        entry("FILENAME=%s", configfile.c_str()));
+        return -1;
+    }
 
-    return rc;
+    return 0;
 }