hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
iroha_conf_loader.cpp File Reference
#include "main/iroha_conf_loader.hpp"
#include <cctype>
#include <cstddef>
#include <cstdlib>
#include <fstream>
#include <functional>
#include <iterator>
#include <limits>
#include <optional>
#include <ostream>
#include <sstream>
#include <string>
#include <string_view>
#include <type_traits>
#include <fmt/core.h>
#include <fmt/format.h>
#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/bind.hpp"
#include "common/files.hpp"
#include "common/result.hpp"
#include "logger/logger.hpp"
#include "main/iroha_conf_literals.hpp"
#include "torii/tls_params.hpp"
Include dependency graph for iroha_conf_loader.cpp:

Classes

class  ConfigParsingException
 
class  JsonDeserializerImpl
 

Typedefs

using ConstJsonValRef = std::reference_wrapper< rapidjson::Value const >
 

Functions

std::optional< std::string_view > getOptEnvRaw (std::string_view key, std::optional< logger::LoggerPtr > log)
 
void assert_fatal (bool condition, std::string_view printable_path, std::string error)
 
logger::LogLevel getLogLevel (std::string level_str, std::string_view printable_path)
 
std::string makeEnvDictChildKey (std::string_view base_path, std::string_view child_key)
 
template<typename T , typename = decltype(std::to_string(std::declval<T>()))>
std::string makeEnvDictChildKey (std::string_view base_path, T const &child_key)
 
template<>
bool JsonDeserializerImpl::loadInto< std::shared_ptr< shared_model::interface::Peer > > (std::shared_ptr< shared_model::interface::Peer > &dest)
 
void reportJsonParsingError (const rapidjson::Document &doc, 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, std::optional< logger::LoggerPtr > log)
 

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...
 
static char const * kEnvVarPrefix = "IROHA"
 

Typedef Documentation

◆ ConstJsonValRef

using ConstJsonValRef = std::reference_wrapper<rapidjson::Value const>

Function Documentation

◆ assert_fatal()

void assert_fatal ( bool  condition,
std::string_view  printable_path,
std::string  error 
)
inline

Throws a runtime exception if the given condition is false.

Parameters
condition
error- error message
Here is the caller graph for this function:

◆ getLogLevel()

logger::LogLevel getLogLevel ( std::string  level_str,
std::string_view  printable_path 
)
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getOptEnvRaw()

std::optional<std::string_view> getOptEnvRaw ( std::string_view  key,
std::optional< logger::LoggerPtr log 
)
Here is the caller graph for this function:

◆ JsonDeserializerImpl::loadInto< std::shared_ptr< shared_model::interface::Peer > >()

template<>
bool JsonDeserializerImpl::loadInto< std::shared_ptr< shared_model::interface::Peer > > ( std::shared_ptr< shared_model::interface::Peer > &  dest)
inline
Here is the call graph for this function:

◆ makeEnvDictChildKey() [1/2]

std::string makeEnvDictChildKey ( std::string_view  base_path,
std::string_view  child_key 
)
Here is the caller graph for this function:

◆ makeEnvDictChildKey() [2/2]

template<typename T , typename = decltype(std::to_string(std::declval<T>()))>
std::string makeEnvDictChildKey ( std::string_view  base_path,
T const &  child_key 
)
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,
std::optional< logger::LoggerPtr log 
)

parse and assert trusted peers json in iroha.conf

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

◆ reportJsonParsingError()

void reportJsonParsingError ( const rapidjson::Document &  doc,
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.

◆ kEnvVarPrefix

char const* kEnvVarPrefix = "IROHA"
static