Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Make executable names configurable #7118

Merged
merged 3 commits into from
Apr 18, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions programs/cleos/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
add_executable( ${CLI_CLIENT_EXECUTABLE_NAME} main.cpp httpc.cpp help_text.cpp localize.hpp config.hpp CLI11.hpp)
configure_file(help_text.cpp.in help_text.cpp @ONLY)
add_executable( ${CLI_CLIENT_EXECUTABLE_NAME} main.cpp httpc.cpp ${CMAKE_CURRENT_BINARY_DIR}/help_text.cpp localize.hpp config.hpp CLI11.hpp)
if( UNIX AND NOT APPLE )
set(rt_library rt )
endif()
Expand Down Expand Up @@ -32,7 +33,7 @@ set(LOCALEDIR ${CMAKE_INSTALL_PREFIX}/share/locale)
set(LOCALEDOMAIN ${CLI_CLIENT_EXECUTABLE_NAME})
configure_file(config.hpp.in config.hpp ESCAPE_QUOTES)

target_include_directories(${CLI_CLIENT_EXECUTABLE_NAME} PUBLIC ${Intl_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR})
target_include_directories(${CLI_CLIENT_EXECUTABLE_NAME} PUBLIC ${Intl_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})

target_link_libraries( ${CLI_CLIENT_EXECUTABLE_NAME}
PRIVATE appbase chain_api_plugin producer_plugin chain_plugin http_plugin eosio_chain fc ${CMAKE_DL_LIBS} ${PLATFORM_SPECIFIC_LIBS} ${Intl_LIBRARIES} )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const char* duplicate_key_import_help_text = _("This key is already imported int
const char* unknown_abi_table_help_text = _(R"text(The ABI for the code on account "${1}" does not specify table "${2}".

Please check the account and table name, and verify that the account has the expected code using:
cleos get code ${1})text");
@CLI_CLIENT_EXECUTABLE_NAME@ get code ${1})text");

const char* failed_to_find_transaction_text = _("Failed to fetch information for transaction: \033[1m${1}\033[0m from the history plugin\n\n"
"\033[32mIf you know the block number which included this transaction you providing it with the \033[2m--block-hint\033[22m option may help\033[0m");
Expand Down Expand Up @@ -201,7 +201,7 @@ const char* error_advice_invalid_ref_block_exception = "Ensure that the referen
const char* error_advice_tx_duplicate = "You can try embedding eosio nonce action inside your transaction to ensure uniqueness.";

const char* error_advice_invalid_action_args_exception = R"=====(Ensure that your arguments follow the contract abi!
You can check the contract's abi by using 'cleos get code' command.)=====";
You can check the contract's abi by using '@CLI_CLIENT_EXECUTABLE_NAME@ get code' command.)=====";

const char* error_advice_permission_query_exception = "Most likely, the given account/ permission doesn't exist in the blockchain.";
const char* error_advice_account_query_exception = "Most likely, the given account doesn't exist in the blockchain.";
Expand All @@ -211,7 +211,7 @@ const char* error_advice_contract_query_exception = "Most likely, the given con
const char* error_advice_tx_irrelevant_sig = "Please remove the unnecessary signature from your transaction!";
const char* error_advice_unsatisfied_authorization = "Ensure that you have the related private keys inside your wallet and your wallet is unlocked.";
const char* error_advice_missing_auth_exception = R"=====(Ensure that you have the related authority inside your transaction!;
If you are currently using 'cleos push action' command, try to add the relevant authority using -p option.)=====";
If you are currently using '@CLI_CLIENT_EXECUTABLE_NAME@ push action' command, try to add the relevant authority using -p option.)=====";
const char* error_advice_irrelevant_auth_exception = "Please remove the unnecessary authority from your action!";

const char* error_advice_missing_chain_api_plugin_exception = "Ensure that you have \033[2meosio::chain_api_plugin\033[0m\033[32m added to your node's configuration!";
Expand Down
2 changes: 1 addition & 1 deletion programs/keosd/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ int main(int argc, char** argv)
if(!app().initialize<wallet_plugin, wallet_api_plugin, http_plugin>(argc, argv))
return -1;
auto& http = app().get_plugin<http_plugin>();
http.add_handler("/v1/keosd/stop", [](string, string, url_response_callback cb) { cb(200, fc::variant(fc::variant_object())); std::raise(SIGTERM); } );
http.add_handler("/v1/" + keosd::config::key_store_executable_name + "/stop", [](string, string, url_response_callback cb) { cb(200, fc::variant(fc::variant_object())); std::raise(SIGTERM); } );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to change the corresponding line in httpc.hpp too

app().startup();
app().exec();
} catch (const fc::exception& e) {
Expand Down
1 change: 1 addition & 0 deletions programs/nodeos/config.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace eosio { namespace nodeos { namespace config {
constexpr uint64_t version = 0x${nodeos_BUILD_VERSION};
const string node_executable_name = "${NODE_EXECUTABLE_NAME}";
}}}

#endif // CONFIG_HPP_IN
12 changes: 6 additions & 6 deletions programs/nodeos/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,19 +87,19 @@ int main(int argc, char** argv)
app().set_version(eosio::nodeos::config::version);

auto root = fc::app_path();
app().set_default_data_dir(root / "eosio/nodeos/data" );
app().set_default_config_dir(root / "eosio/nodeos/config" );
app().set_default_data_dir(root / "eosio" / nodeos::config::node_executable_name / "data" );
app().set_default_config_dir(root / "eosio" / nodeos::config::node_executable_name / "config" );
http_plugin::set_defaults({
.default_unix_socket_path = "",
.default_http_port = 8888
});
if(!app().initialize<chain_plugin, net_plugin, producer_plugin>(argc, argv))
return INITIALIZE_FAIL;
initialize_logging();
ilog("nodeos version ${ver}", ("ver", app().version_string()));
ilog("${name} version ${ver}", ("name", nodeos::config::node_executable_name)("ver", app().version_string()));
ilog("eosio root is ${root}", ("root", root.string()));
ilog("nodeos using configuration file ${c}", ("c", app().full_config_file_path().string()));
ilog("nodeos data directory is ${d}", ("d", app().data_dir().string()));
ilog("${name} using configuration file ${c}", ("name", nodeos::config::node_executable_name)("c", app().full_config_file_path().string()));
ilog("${name} data directory is ${d}", ("name", nodeos::config::node_executable_name)("d", app().data_dir().string()));
app().startup();
app().exec();
} catch( const extract_genesis_state_exception& e ) {
Expand Down Expand Up @@ -145,6 +145,6 @@ int main(int argc, char** argv)
return OTHER_FAIL;
}

ilog("nodeos successfully exiting");
ilog("${name} successfully exiting", ("name", nodeos::config::node_executable_name));
return SUCCESS;
}