mgmt: add sample configuration file and install default configuration

refs: #1332

Change-Id: Ic50aac57382b9760aa3b1c22b7dd2a9fec589cf9
diff --git a/daemon/mgmt/config-file.cpp b/daemon/mgmt/config-file.cpp
index 8018310..e5bbb9d 100644
--- a/daemon/mgmt/config-file.cpp
+++ b/daemon/mgmt/config-file.cpp
@@ -26,11 +26,11 @@
 }
 
 void
-ConfigFile::parse(const char* filename, bool isDryRun)
+ConfigFile::parse(const std::string& filename, bool isDryRun)
 {
   std::ifstream inputFile;
-  inputFile.open(filename);
-  if (!inputFile.is_open())
+  inputFile.open(filename.c_str());
+  if (!inputFile.good() || !inputFile.is_open())
     {
       std::string msg = "Failed to read configuration file: ";
       msg += filename;
@@ -41,7 +41,7 @@
 }
 
 void
-ConfigFile::parse(const std::string& input, bool isDryRun, const char* filename)
+ConfigFile::parse(const std::string& input, bool isDryRun, const std::string& filename)
 {
   std::istringstream inputStream(input);
   parse(inputStream, isDryRun, filename);
@@ -49,7 +49,7 @@
 
 
 void
-ConfigFile::parse(std::istream& input, bool isDryRun, const char* filename)
+ConfigFile::parse(std::istream& input, bool isDryRun, const std::string& filename)
 {
   try
     {
@@ -59,10 +59,7 @@
     {
       std::stringstream msg;
       msg << "Failed to parse configuration file";
-      if (filename != 0)
-        {
-          msg << " " << filename;
-        }
+      msg << " " << filename;
       msg << " " << error.message() << " line " << error.line();
       throw Error(msg.str());
     }
@@ -71,18 +68,16 @@
 }
 
 void
-ConfigFile::process(bool isDryRun, const char* filename)
+ConfigFile::process(bool isDryRun, const std::string& filename)
 {
+  BOOST_ASSERT(!filename.empty());
   // NFD_LOG_DEBUG("processing..." << ((isDryRun)?("dry run"):("")));
 
   if (m_global.begin() == m_global.end())
     {
       std::string msg = "Error processing configuration file";
-      if (filename != 0)
-        {
-          msg += ": ";
-          msg += filename;
-        }
+      msg += ": ";
+      msg += filename;
       msg += " no data";
       throw Error(msg);
     }
@@ -101,11 +96,8 @@
       else
         {
           std::string msg = "Error processing configuration file";
-          if (filename != 0)
-            {
-              msg += " ";
-              msg += filename;
-            }
+          msg += " ";
+          msg += filename;
           msg += " no module subscribed for section: " + sectionName;
           throw Error(msg);
         }