9 #include <boost/filesystem.hpp>
10 #include <boost/program_options.hpp>
11 #include <boost/property_tree/ini_parser.hpp>
12 #include "bootloader/bootloader.h"
13 #include "crypto/keymanager_config.h"
14 #include "crypto/p11_config.h"
15 #include "logging/logging_config.h"
16 #include "package_manager/packagemanagerconfig.h"
17 #include "storage/storage_config.h"
18 #include "telemetry/telemetryconfig.h"
19 #include "utilities/config_utils.h"
22 enum class ProvisionMode { kSharedCred = 0, kDeviceCred };
29 boost::filesystem::path server_url_path;
30 CryptoSource ca_source{CryptoSource::kFile};
31 CryptoSource pkey_source{CryptoSource::kFile};
32 CryptoSource cert_source{CryptoSource::kFile};
34 void updateFromPropertyTree(
const boost::property_tree::ptree& pt);
35 void writeToStream(std::ostream& out_stream)
const;
40 std::string p12_password;
41 std::string expiry_days{
"36000"};
42 boost::filesystem::path provision_path;
43 ProvisionMode mode{ProvisionMode::kSharedCred};
44 std::string device_id;
45 std::string primary_ecu_serial;
46 std::string primary_ecu_hardware_id;
47 std::string ecu_registration_endpoint;
49 void updateFromPropertyTree(
const boost::property_tree::ptree& pt);
50 void writeToStream(std::ostream& out_stream)
const;
54 uint64_t polling_sec{10U};
55 std::string director_server;
56 std::string repo_server;
57 CryptoSource key_source{CryptoSource::kFile};
58 KeyType key_type{KeyType::kRSA2048};
59 bool force_install_completion{
false};
60 boost::filesystem::path secondary_config_file;
61 uint64_t secondary_preinstall_wait_sec{600U};
63 void updateFromPropertyTree(
const boost::property_tree::ptree& pt);
64 void writeToStream(std::ostream& out_stream)
const;
77 explicit Config(
const boost::program_options::variables_map& cmd);
78 explicit Config(
const boost::filesystem::path& filename);
79 explicit Config(
const std::vector<boost::filesystem::path>& config_dirs);
83 void updateFromTomlString(
const std::string& contents);
84 void postUpdateValues();
85 void writeToStream(std::ostream& sink)
const;
101 void updateFromPropertyTree(
const boost::property_tree::ptree& pt)
override;
102 void updateFromCommandLine(
const boost::program_options::variables_map& cmd);
104 std::vector<boost::filesystem::path> config_dirs_ = {
"/usr/lib/sota/conf.d",
"/etc/sota/conf.d/"};
105 bool loglevel_from_cmdline{
false};
108 std::ostream& operator<<(std::ostream& os,
const Config& cfg);