buffet: support using default flag values
A previous change added support for overridding the configuration and
state paths, for testing, but resulted in the defaults not being used
since the empty string was passed for a flag value. This changes the
init script so that empty paths from the upstart environment are not
used as flag values.
TEST=built, tested on device, tested with override
BUG=none
Change-Id: Id680ec7434b4c523cd0a2c8419dcf342a0a34199
Reviewed-on: https://chromium-review.googlesource.com/248580
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Aaron Kemp <kemp@google.com>
Tested-by: Aaron Kemp <kemp@google.com>
diff --git a/buffet/main.cc b/buffet/main.cc
index 1dc3388..ab3798a 100644
--- a/buffet/main.cc
+++ b/buffet/main.cc
@@ -60,11 +60,13 @@
"Path to file containing config information.");
DEFINE_string(state_path, kDefaultStateFilePath,
"Path to file containing state information.");
+ chromeos::FlagHelper::Init(argc, argv, "Privet protocol handler daemon");
+
if (FLAGS_config_path.empty())
FLAGS_config_path = kDefaultConfigFilePath;
if (FLAGS_state_path.empty())
FLAGS_state_path = kDefaultStateFilePath;
- chromeos::FlagHelper::Init(argc, argv, "Privet protocol handler daemon");
+
chromeos::InitLog(chromeos::kLogToSyslog | chromeos::kLogHeader);
buffet::Daemon daemon{base::FilePath{FLAGS_config_path},
base::FilePath{FLAGS_state_path}};