buffet: Rework buffet configuration
Manufacturer supplied fields will come from the buffet configuration
file with good defaults provided by buffet itself. This includes
a few default values for user supplied fields.
User supplied and other per device instance state will be stored in
a state file as before.
Keeping these fields separate greatly simplifies reasoning about
adding configuration settings to buffet.
BUG=brillo:658
TEST=unittests, tendo_experimental passes
CQ-DEPEND=CL:262292
Change-Id: Ib74721b9c99d11c189042aa78cc43a076072de32
Reviewed-on: https://chromium-review.googlesource.com/262296
Tested-by: Christopher Wiley <wiley@chromium.org>
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Reviewed-by: Anton Muhin <antonm@chromium.org>
Commit-Queue: Christopher Wiley <wiley@chromium.org>
diff --git a/buffet/manager.cc b/buffet/manager.cc
index f7bef10..6097b09 100644
--- a/buffet/manager.cc
+++ b/buffet/manager.cc
@@ -59,17 +59,16 @@
new StateChangeQueue(kMaxStateChangeQueueSize));
state_manager_ = std::make_shared<StateManager>(state_change_queue_.get());
state_manager_->Startup();
- std::unique_ptr<chromeos::KeyValueStore> config_store{
- new chromeos::KeyValueStore};
+ std::unique_ptr<BuffetConfig> config{new BuffetConfig};
+ config->Load(config_path);
std::unique_ptr<FileStorage> state_store{new FileStorage{state_path}};
- config_store->Load(config_path);
// TODO(avakulenko): Figure out security implications of storing
// device info state data unencrypted.
device_info_ = std::unique_ptr<DeviceRegistrationInfo>(
new DeviceRegistrationInfo(
command_manager_,
state_manager_,
- std::move(config_store),
+ std::move(config),
chromeos::http::Transport::CreateDefault(),
std::move(state_store),
base::Bind(&Manager::OnRegistrationStatusChanged,