hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
iroha_conf_loader.cpp File Reference
#include "main/iroha_conf_loader.hpp"
#include <fstream>
#include <limits>
#include <sstream>
#include <type_traits>
#include <rapidjson/document.h>
#include <rapidjson/error/en.h>
#include <rapidjson/rapidjson.h>
#include <boost/algorithm/string/join.hpp>
#include <boost/range/adaptor/map.hpp>
#include "common/files.hpp"
#include "common/result.hpp"
#include "main/iroha_conf_literals.hpp"
#include "torii/tls_params.hpp"
Include dependency graph for iroha_conf_loader.cpp:

Classes

class  JsonDeserializerException
 
class  JsonDeserializerImpl
 

Functions

template<>
void JsonDeserializerImpl::getVal< std::string > (const std::string &path, std::string &dest, const rapidjson::Value &src)
 
template<>
void JsonDeserializerImpl::getVal< logger::LogLevel > (const std::string &path, logger::LogLevel &dest, const rapidjson::Value &src)
 
template<>
void JsonDeserializerImpl::getVal< logger::LogPatterns > (const std::string &path, logger::LogPatterns &dest, const rapidjson::Value &src)
 
template<>
void JsonDeserializerImpl::getVal< std::unique_ptr< logger::LoggerManagerTree > > (const std::string &path, std::unique_ptr< logger::LoggerManagerTree > &dest, const rapidjson::Value &src)
 
template<>
void JsonDeserializerImpl::getVal< std::unique_ptr< shared_model::interface::Peer > > (const std::string &path, std::unique_ptr< shared_model::interface::Peer > &dest, const rapidjson::Value &src)
 
template<>
void JsonDeserializerImpl::getVal< iroha::torii::TlsParams > (const std::string &path, iroha::torii::TlsParams &dest, const rapidjson::Value &src)
 
template<>
void JsonDeserializerImpl::getVal< IrohadConfig::InterPeerTls > (const std::string &path, IrohadConfig::InterPeerTls &dest, const rapidjson::Value &src)
 
template<>
void JsonDeserializerImpl::getVal< IrohadConfig::InterPeerTls::PeerCertProvider > (const std::string &path, IrohadConfig::InterPeerTls::PeerCertProvider &dest, const rapidjson::Value &src)
 
template<>
void JsonDeserializerImpl::getVal< IrohadConfig::DbConfig > (const std::string &path, IrohadConfig::DbConfig &dest, const rapidjson::Value &src)
 
template<>
void JsonDeserializerImpl::getVal< IrohadConfig::UtilityService > (const std::string &path, IrohadConfig::UtilityService &dest, const rapidjson::Value &src)
 
template<>
void JsonDeserializerImpl::getVal< IrohadConfig::DataModelModule::Python > (const std::string &path, IrohadConfig::DataModelModule::Python &dest, const rapidjson::Value &src)
 
template<>
void JsonDeserializerImpl::getVal< IrohadConfig::DataModelModule::ModuleType > (const std::string &path, IrohadConfig::DataModelModule::ModuleType &dest, const rapidjson::Value &src)
 
template<>
void JsonDeserializerImpl::getVal< IrohadConfig::DataModelModule > (const std::string &path, IrohadConfig::DataModelModule &dest, const rapidjson::Value &src)
 
std::string reportJsonParsingError (const rapidjson::Document &doc, const std::string &conf_path, const std::string &text)
 
iroha::expected::Result< IrohadConfig, std::string > parse_iroha_config (const std::string &conf_path, std::shared_ptr< shared_model::interface::CommonObjectsFactory > common_objects_factory)
 

Variables

static constexpr size_t kBadJsonPrintLength = 15
 
static constexpr size_t kBadJsonPrintOffsset = 5
 The offset of printed chunk towards file start from the error position. More...
 

Function Documentation

◆ JsonDeserializerImpl::getVal< iroha::torii::TlsParams >()

template<>
void JsonDeserializerImpl::getVal< iroha::torii::TlsParams > ( const std::string &  path,
iroha::torii::TlsParams dest,
const rapidjson::Value &  src 
)
inline

◆ JsonDeserializerImpl::getVal< IrohadConfig::DataModelModule >()

template<>
void JsonDeserializerImpl::getVal< IrohadConfig::DataModelModule > ( const std::string &  path,
IrohadConfig::DataModelModule dest,
const rapidjson::Value &  src 
)
inline

◆ JsonDeserializerImpl::getVal< IrohadConfig::DataModelModule::ModuleType >()

template<>
void JsonDeserializerImpl::getVal< IrohadConfig::DataModelModule::ModuleType > ( const std::string &  path,
IrohadConfig::DataModelModule::ModuleType dest,
const rapidjson::Value &  src 
)
inline

◆ JsonDeserializerImpl::getVal< IrohadConfig::DataModelModule::Python >()

template<>
void JsonDeserializerImpl::getVal< IrohadConfig::DataModelModule::Python > ( const std::string &  path,
IrohadConfig::DataModelModule::Python dest,
const rapidjson::Value &  src 
)
inline

◆ JsonDeserializerImpl::getVal< IrohadConfig::DbConfig >()

template<>
void JsonDeserializerImpl::getVal< IrohadConfig::DbConfig > ( const std::string &  path,
IrohadConfig::DbConfig dest,
const rapidjson::Value &  src 
)
inline

◆ JsonDeserializerImpl::getVal< IrohadConfig::InterPeerTls >()

template<>
void JsonDeserializerImpl::getVal< IrohadConfig::InterPeerTls > ( const std::string &  path,
IrohadConfig::InterPeerTls dest,
const rapidjson::Value &  src 
)
inline

◆ JsonDeserializerImpl::getVal< IrohadConfig::InterPeerTls::PeerCertProvider >()

template<>
void JsonDeserializerImpl::getVal< IrohadConfig::InterPeerTls::PeerCertProvider > ( const std::string &  path,
IrohadConfig::InterPeerTls::PeerCertProvider dest,
const rapidjson::Value &  src 
)
inline

◆ JsonDeserializerImpl::getVal< IrohadConfig::UtilityService >()

template<>
void JsonDeserializerImpl::getVal< IrohadConfig::UtilityService > ( const std::string &  path,
IrohadConfig::UtilityService dest,
const rapidjson::Value &  src 
)
inline

◆ JsonDeserializerImpl::getVal< logger::LogLevel >()

template<>
void JsonDeserializerImpl::getVal< logger::LogLevel > ( const std::string &  path,
logger::LogLevel dest,
const rapidjson::Value &  src 
)
inline

◆ JsonDeserializerImpl::getVal< logger::LogPatterns >()

template<>
void JsonDeserializerImpl::getVal< logger::LogPatterns > ( const std::string &  path,
logger::LogPatterns dest,
const rapidjson::Value &  src 
)
inline

◆ JsonDeserializerImpl::getVal< std::string >()

template<>
void JsonDeserializerImpl::getVal< std::string > ( const std::string &  path,
std::string &  dest,
const rapidjson::Value &  src 
)
inline

◆ JsonDeserializerImpl::getVal< std::unique_ptr< logger::LoggerManagerTree > >()

template<>
void JsonDeserializerImpl::getVal< std::unique_ptr< logger::LoggerManagerTree > > ( const std::string &  path,
std::unique_ptr< logger::LoggerManagerTree > &  dest,
const rapidjson::Value &  src 
)
inline

◆ JsonDeserializerImpl::getVal< std::unique_ptr< shared_model::interface::Peer > >()

template<>
void JsonDeserializerImpl::getVal< std::unique_ptr< shared_model::interface::Peer > > ( const std::string &  path,
std::unique_ptr< shared_model::interface::Peer > &  dest,
const rapidjson::Value &  src 
)
inline
Here is the call graph for this function:

◆ parse_iroha_config()

iroha::expected::Result<IrohadConfig, std::string> parse_iroha_config ( const std::string &  conf_path,
std::shared_ptr< shared_model::interface::CommonObjectsFactory common_objects_factory 
)

parse and assert trusted peers json in iroha.conf

Parameters
conf_pathis a path to iroha's config
Returns
a parsed equivalent of that file
Here is the call graph for this function:
Here is the caller graph for this function:

◆ reportJsonParsingError()

std::string reportJsonParsingError ( const rapidjson::Document &  doc,
const std::string &  conf_path,
const std::string &  text 
)
Here is the caller graph for this function:

Variable Documentation

◆ kBadJsonPrintLength

constexpr size_t kBadJsonPrintLength = 15
static

Copyright Soramitsu Co., Ltd. All Rights Reserved. SPDX-License-Identifier: Apache-2.0The length of the string around the error place to print in case of JSON syntax error.

◆ kBadJsonPrintOffsset

constexpr size_t kBadJsonPrintOffsset = 5
static

The offset of printed chunk towards file start from the error position.