예제 #1
0
void http_client_plugin::plugin_initialize(const variables_map& options) {
   if ( options.count("https-client-root-cert") ) {
      const std::vector<std::string> root_pems = options["https-client-root-cert"].as<std::vector<std::string>>();
      for (const auto& root_pem : root_pems) {
         std::string pem_str = root_pem;
         if (!boost::algorithm::starts_with(pem_str, "-----BEGIN CERTIFICATE-----\n")) {
            try {
               auto infile = std::ifstream(pem_str);
               std::stringstream sstr;
               sstr << infile.rdbuf();
               pem_str = sstr.str();
               FC_ASSERT(boost::algorithm::starts_with(pem_str, "-----BEGIN CERTIFICATE-----\n"), "File does not appear to be a PEM encoded certificate");
            } catch (const fc::exception& e) {
               elog("Failed to read PEM ${f} : ${e}", ("f", root_pem)("e",e.to_detail_string()));
            }
         }

         try {
            my->add_cert(pem_str);
         } catch (const fc::exception& e) {
            elog("Failed to read PEM : ${e} \n${pem}\n", ("pem", pem_str)("e",e.to_detail_string()));
         }
      }
   }

   my->set_verify_peers(options.at("https-client-validate-peers").as<bool>());
}
예제 #2
0
void wallet_api_plugin::plugin_initialize(const variables_map& options) {
   if (options.count("http-server-address")) {
      const auto& lipstr = options.at("http-server-address").as<string>();
      const auto& host = lipstr.substr(0, lipstr.find(':'));
      if (host != "localhost" && host != "127.0.0.1") {
         wlog("\n"
              "*************************************\n"
              "*                                   *\n"
              "*  --   Wallet NOT on localhost  -- *\n"
              "*  - Password and/or Private Keys - *\n"
              "*  - are transferred unencrypted. - *\n"
              "*                                   *\n"
              "*************************************\n");
      }
   }
}
예제 #3
0
   void history_plugin::plugin_initialize(const variables_map& options) {
      if(options.count("filter_on_accounts"))
      {
         auto foa = options.at("filter_on_accounts").as<vector<string>>();
         for(auto filter_account : foa)
            my->filter_on.emplace(filter_account);
      }

      my->chain_plug = app().find_plugin<chain_plugin>();
      auto& chain = my->chain_plug->chain();

      chain.db().add_index<account_history_index>();
      chain.db().add_index<action_history_index>();

      chain.applied_transaction.connect( [&]( const transaction_trace_ptr& p ){
            my->on_applied_transaction(p);
      });

   }
예제 #4
0
void txn_test_gen_plugin::plugin_initialize(const variables_map& options) {
   try {
      my.reset( new txn_test_gen_plugin_impl );
      my->txn_reference_block_lag = options.at( "txn-reference-block-lag" ).as<int32_t>();
   } FC_LOG_AND_RETHROW()
}