github.com/igggame/nebulas-go@v2.1.0+incompatible/nbre/common/configuration.cpp (about)

     1  // Copyright (C) 2018 go-nebulas authors
     2  //
     3  // This file is part of the go-nebulas library.
     4  //
     5  // the go-nebulas library is free software: you can redistribute it and/or
     6  // modify
     7  // it under the terms of the GNU General Public License as published by
     8  // the Free Software Foundation, either version 3 of the License, or
     9  // (at your option) any later version.
    10  //
    11  // the go-nebulas library is distributed in the hope that it will be useful,
    12  // but WITHOUT ANY WARRANTY; without even the implied warranty of
    13  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    14  // GNU General Public License for more details.
    15  //
    16  // You should have received a copy of the GNU General Public License
    17  // along with the go-nebulas library.  If not, see
    18  // <http://www.gnu.org/licenses/>.
    19  //
    20  #include "common/configuration.h"
    21  
    22  #include <boost/property_tree/ptree.hpp>
    23  #include <boost/property_tree/ini_parser.hpp>
    24  #include <boost/format.hpp>
    25  #include <boost/program_options.hpp>
    26  #include <string>
    27  #include <set>
    28  #include <exception>
    29  #include <iostream>
    30  
    31  namespace neb {
    32  namespace pt = boost::property_tree;
    33  namespace po = boost::program_options;
    34  
    35  #define KTS(v) #v
    36  #define STR(v) KTS(v)
    37  configuration::configuration() {
    38  #ifdef NDEBUG
    39    // supervisor start failed with getenv
    40  #else
    41    m_nbre_root_dir = std::getenv("NBRE_ROOT_DIR");
    42    m_nbre_exe_name = std::getenv("NBRE_EXE_NAME");
    43    m_neb_db_dir = std::getenv("NEB_DB_DIR");
    44    m_nbre_db_dir = std::getenv("NBRE_DB_DIR");
    45    m_nbre_log_dir = std::getenv("NBRE_LOG_DIR");
    46  #endif
    47  }
    48  #undef STR
    49  #undef KTS
    50  
    51  configuration::~configuration() = default;
    52  
    53  bool use_test_blockchain = false;
    54  bool glog_log_to_stderr = true;
    55  } // namespace neb
    56