Aktualizr
C++ SOTA Client
aktualizr_secondary_config.h
1 #ifndef AKTUALIZR_SECONDARY_CONFIG_H_
2 #define AKTUALIZR_SECONDARY_CONFIG_H_
3 
4 #include <boost/filesystem.hpp>
5 #include <boost/program_options.hpp>
6 #include <boost/property_tree/ini_parser.hpp>
7 
8 #include "libaktualizr/config.h"
9 #include "utilities/config_utils.h"
10 
11 // Try to keep the order of config options the same as in
12 // AktualizrSecondaryConfig::writeToStream() and
13 // AktualizrSecondaryConfig::updateFromPropertyTree().
14 
16  in_port_t port{9030};
17  std::string primary_ip;
18  in_port_t primary_port{9030};
19 
20  void updateFromPropertyTree(const boost::property_tree::ptree& pt);
21  void writeToStream(std::ostream& out_stream) const;
22 };
23 
25  std::string ecu_serial;
26  std::string ecu_hardware_id;
27  CryptoSource key_source{CryptoSource::kFile};
28  KeyType key_type{KeyType::kRSA2048};
29  bool force_install_completion{false};
30 
31  void updateFromPropertyTree(const boost::property_tree::ptree& pt);
32  void writeToStream(std::ostream& out_stream) const;
33 };
34 
36  public:
37  AktualizrSecondaryConfig() = default;
38  AktualizrSecondaryConfig(const boost::program_options::variables_map& cmd);
39  explicit AktualizrSecondaryConfig(const boost::filesystem::path& filename);
40 
41  KeyManagerConfig keymanagerConfig() const;
42 
43  void postUpdateValues();
44  void writeToStream(std::ostream& sink) const;
45 
46  // from Primary config
47  LoggerConfig logger;
48 
51 
52  // from Primary config
53  P11Config p11;
54  PackageConfig pacman;
55  BootloaderConfig bootloader;
56  StorageConfig storage;
57  ImportConfig import;
58 
59  private:
60  void updateFromCommandLine(const boost::program_options::variables_map& cmd);
61  void updateFromPropertyTree(const boost::property_tree::ptree& pt) override;
62 };
63 std::ostream& operator<<(std::ostream& os, const AktualizrSecondaryConfig& cfg);
64 
65 #endif // AKTUALIZR_SECONDARY_CONFIG_H_
BaseConfig
The BaseConfig class.
Definition: config.h:181
AktualizrSecondaryUptaneConfig
Definition: aktualizr_secondary_config.h:24
AktualizrSecondaryConfig
Definition: aktualizr_secondary_config.h:35
AktualizrSecondaryNetConfig
Definition: aktualizr_secondary_config.h:15
StorageConfig
Definition: config.h:111
P11Config
Definition: config.h:28
LoggerConfig
Definition: config.h:18
KeyManagerConfig
Definition: config.h:168
PackageConfig
Definition: config.h:91
BootloaderConfig
Definition: config.h:156
ImportConfig
Definition: config.h:130