hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
iroha_conf_loader.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_CONF_LOADER_HPP
7 #define IROHA_CONF_LOADER_HPP
8 
9 #include <string>
10 #include <unordered_map>
11 
12 #include "common/result_fwd.hpp"
15 #include "logger/logger_fwd.hpp"
17 #include "multihash/type.hpp"
18 #include "torii/tls_params.hpp"
19 
20 struct IrohadConfig {
21  struct DbConfig {
22  std::string host;
23  uint16_t port;
24  std::string user;
25  std::string password;
26  std::string working_dbname;
27  std::string maintenance_dbname;
28  };
29 
30  struct InterPeerTls {
31  struct RootCert {
32  std::string path;
33  };
34  struct FromWsv {};
35  struct None {};
36  using PeerCertProvider = boost::variant<RootCert, FromWsv, None>;
37 
38  boost::optional<std::string> my_tls_creds_path;
40  };
41 
42  struct UtilityService {
43  std::string ip;
44  uint16_t port;
45  };
46 
47  // TODO: block_store_path is now optional, change docs IR-576
48  // luckychess 29.06.2019
49  boost::optional<std::string> block_store_path;
50  uint16_t torii_port;
51  boost::optional<iroha::torii::TlsParams> torii_tls_params;
52  boost::optional<InterPeerTls> inter_peer_tls;
53  uint16_t internal_port;
54  boost::optional<std::string>
55  pg_opt; // TODO 2019.06.26 mboldyrev IR-556 remove
56  boost::optional<DbConfig>
57  database_config; // TODO 2019.06.26 mboldyrev IR-556 make required
59  uint32_t proposal_delay;
60  uint32_t vote_delay;
62  boost::optional<uint32_t> mst_expiration_time;
63  boost::optional<uint32_t> max_round_delay_ms;
64  boost::optional<uint32_t> stale_stream_max_rounds;
65  boost::optional<logger::LoggerManagerTreePtr> logger_manager;
66  boost::optional<shared_model::interface::types::PeerList> initial_peers;
67  boost::optional<UtilityService> utility_service;
68 
69  // This is a part of cryto providers feature:
70  // https://github.com/MBoldyrev/iroha/tree/feature/hsm-utimaco.
71  // This brings unnecessary complexity, but the aim is that this config section
72  // should require no modifications from users when the feature branch is
73  // merged.
74  struct Crypto {
75  struct Default {
76  static char const *kName;
78  std::optional<std::string> private_key;
79  };
80 
81  using ProviderId = std::string;
82  using ProviderList = std::unordered_map<ProviderId, Default>;
83 
86  };
87 
88  boost::optional<Crypto> crypto;
89 };
90 
97  const std::string &conf_path,
98  std::shared_ptr<shared_model::interface::CommonObjectsFactory>
99  common_objects_factory,
100  std::optional<logger::LoggerPtr> log);
101 
102 #endif // IROHA_CONF_LOADER_HPP
std::string maintenance_dbname
Definition: iroha_conf_loader.hpp:27
ProviderList providers
Definition: iroha_conf_loader.hpp:84
uint16_t port
Definition: iroha_conf_loader.hpp:23
Definition: iroha_conf_loader.hpp:75
boost::optional< uint32_t > max_round_delay_ms
Definition: iroha_conf_loader.hpp:63
Type
https://github.com/multiformats/js-multihash/blob/master/src/constants.js
Definition: type.hpp:14
boost::variant< RootCert, FromWsv, None > PeerCertProvider
Definition: iroha_conf_loader.hpp:36
std::optional< std::string > private_key
Definition: iroha_conf_loader.hpp:78
PeerCertProvider peer_certificates
Definition: iroha_conf_loader.hpp:39
uint16_t port
Definition: iroha_conf_loader.hpp:44
static char const * kName
Definition: iroha_conf_loader.hpp:76
Definition: result_fwd.hpp:27
boost::optional< iroha::torii::TlsParams > torii_tls_params
Definition: iroha_conf_loader.hpp:51
Definition: iroha_conf_loader.hpp:42
Definition: iroha_conf_loader.hpp:74
boost::optional< uint32_t > stale_stream_max_rounds
Definition: iroha_conf_loader.hpp:64
boost::optional< InterPeerTls > inter_peer_tls
Definition: iroha_conf_loader.hpp:52
std::string host
Definition: iroha_conf_loader.hpp:22
boost::optional< std::string > my_tls_creds_path
Definition: iroha_conf_loader.hpp:38
Definition: iroha_conf_loader.hpp:34
uint32_t proposal_delay
Definition: iroha_conf_loader.hpp:59
std::string ProviderId
Definition: iroha_conf_loader.hpp:81
Definition: iroha_conf_loader.hpp:31
std::string ip
Definition: iroha_conf_loader.hpp:43
std::unordered_map< ProviderId, Default > ProviderList
Definition: iroha_conf_loader.hpp:82
Definition: iroha_conf_loader.hpp:20
uint16_t internal_port
Definition: iroha_conf_loader.hpp:53
Definition: iroha_conf_loader.hpp:35
uint32_t max_proposal_size
Definition: iroha_conf_loader.hpp:58
boost::optional< std::string > pg_opt
Definition: iroha_conf_loader.hpp:55
iroha::expected::Result< IrohadConfig, std::string > parse_iroha_config(const std::string &conf_path, std::shared_ptr< shared_model::interface::CommonObjectsFactory > common_objects_factory, std::optional< logger::LoggerPtr > log)
Definition: iroha_conf_loader.cpp:748
boost::optional< Crypto > crypto
Definition: iroha_conf_loader.hpp:88
boost::optional< shared_model::interface::types::PeerList > initial_peers
Definition: iroha_conf_loader.hpp:66
std::string password
Definition: iroha_conf_loader.hpp:25
ProviderId signer
Definition: iroha_conf_loader.hpp:85
boost::optional< uint32_t > mst_expiration_time
Definition: iroha_conf_loader.hpp:62
iroha::multihash::Type type
Definition: iroha_conf_loader.hpp:77
bool mst_support
Definition: iroha_conf_loader.hpp:61
std::string working_dbname
Definition: iroha_conf_loader.hpp:26
boost::optional< std::string > block_store_path
Definition: iroha_conf_loader.hpp:49
uint32_t vote_delay
Definition: iroha_conf_loader.hpp:60
std::string user
Definition: iroha_conf_loader.hpp:24
boost::optional< logger::LoggerManagerTreePtr > logger_manager
Definition: iroha_conf_loader.hpp:65
boost::optional< DbConfig > database_config
Definition: iroha_conf_loader.hpp:57
Definition: iroha_conf_loader.hpp:21
Definition: iroha_conf_loader.hpp:30
uint16_t torii_port
Definition: iroha_conf_loader.hpp:50
std::string path
Definition: iroha_conf_loader.hpp:32
boost::optional< UtilityService > utility_service
Definition: iroha_conf_loader.hpp:67