Skip to content
Snippets Groups Projects
Commit 6892366c authored by Ramin Yaghoubzadeh Torky's avatar Ramin Yaghoubzadeh Torky
Browse files

C++: --rsb-host and --rsb-port default parameters for ipaaca binaries

parent 0906549c
No related branches found
No related tags found
No related merge requests found
...@@ -209,6 +209,11 @@ IPAACA_MEMBER_VAR_EXPORT extern std::string __ipaaca_static_option_default_chann ...@@ -209,6 +209,11 @@ IPAACA_MEMBER_VAR_EXPORT extern std::string __ipaaca_static_option_default_chann
/// Current console log level (defaults to warning), one of: IPAACA_LOG_LEVEL_CRITICAL, IPAACA_LOG_LEVEL_ERROR, IPAACA_LOG_LEVEL_WARNING, IPAACA_LOG_LEVEL_INFO, IPAACA_LOG_LEVEL_DEBUG, IPAACA_LOG_LEVEL_NONE /// Current console log level (defaults to warning), one of: IPAACA_LOG_LEVEL_CRITICAL, IPAACA_LOG_LEVEL_ERROR, IPAACA_LOG_LEVEL_WARNING, IPAACA_LOG_LEVEL_INFO, IPAACA_LOG_LEVEL_DEBUG, IPAACA_LOG_LEVEL_NONE
IPAACA_MEMBER_VAR_EXPORT extern unsigned int __ipaaca_static_option_log_level; IPAACA_MEMBER_VAR_EXPORT extern unsigned int __ipaaca_static_option_log_level;
/// RSB host to connect to (defaults to "" = do not set, use global config)
IPAACA_MEMBER_VAR_EXPORT extern std::string __ipaaca_static_option_rsb_host;
/// RSB port to connect to (defaults to "" = do not set, use global config)
IPAACA_MEMBER_VAR_EXPORT extern std::string __ipaaca_static_option_rsb_port;
IPAACA_MEMBER_VAR_EXPORT Lock& logger_lock(); IPAACA_MEMBER_VAR_EXPORT Lock& logger_lock();
#ifdef WIN32 #ifdef WIN32
......
...@@ -90,6 +90,8 @@ void CommandLineParser::initialize_parser_defaults() ...@@ -90,6 +90,8 @@ void CommandLineParser::initialize_parser_defaults()
add_option("ipaaca-default-channel", 0, true, "default"); add_option("ipaaca-default-channel", 0, true, "default");
add_option("ipaaca-enable-logging", 0, true, "WARNING"); add_option("ipaaca-enable-logging", 0, true, "WARNING");
add_option("rsb-enable-logging", 0, true, "ERROR"); add_option("rsb-enable-logging", 0, true, "ERROR");
add_option("rsb-host", 0, true, ""); // empty = don't set
add_option("rsb-port", 0, true, ""); // empty = don't set
} }
} }
...@@ -108,6 +110,14 @@ bool CommandLineParser::consume_library_option(const std::string& name, bool exp ...@@ -108,6 +110,14 @@ bool CommandLineParser::consume_library_option(const std::string& name, bool exp
std::string newch = optarg; std::string newch = optarg;
IPAACA_DEBUG("Setting default channel " << newch) IPAACA_DEBUG("Setting default channel " << newch)
__ipaaca_static_option_default_channel = newch; __ipaaca_static_option_default_channel = newch;
} else if (name=="rsb-host") {
std::string newhost = optarg;
IPAACA_DEBUG("Setting RSB host " << newhost)
__ipaaca_static_option_rsb_host = newhost;
} else if (name=="rsb-port") {
std::string newport = optarg;
IPAACA_DEBUG("Setting RSB port " << newport)
__ipaaca_static_option_rsb_port = newport;
} else if (name=="ipaaca-enable-logging") { } else if (name=="ipaaca-enable-logging") {
std::string level(optarg); std::string level(optarg);
if ((level=="NONE") || (level=="SILENT")) { if ((level=="NONE") || (level=="SILENT")) {
......
...@@ -97,6 +97,16 @@ IPAACA_EXPORT void Initializer::dump_current_default_config()//{{{ ...@@ -97,6 +97,16 @@ IPAACA_EXPORT void Initializer::dump_current_default_config()//{{{
}//}}} }//}}}
IPAACA_EXPORT void Initializer::auto_configure_rsb()//{{{ IPAACA_EXPORT void Initializer::auto_configure_rsb()//{{{
{ {
// set RSB host and port iff provided using cmdline arguments
if (__ipaaca_static_option_rsb_host!="") {
IPAACA_INFO("Overriding RSB host with " << __ipaaca_static_option_rsb_host)
setenv("RSB_TRANSPORT_SPREAD_HOST", __ipaaca_static_option_rsb_host.c_str(), 1);
}
if (__ipaaca_static_option_rsb_port!="") {
IPAACA_INFO("Overriding RSB port with " << __ipaaca_static_option_rsb_port)
setenv("RSB_TRANSPORT_SPREAD_PORT", __ipaaca_static_option_rsb_port.c_str(), 1);
}
const char* plugin_path = getenv("RSB_PLUGINS_CPP_PATH"); const char* plugin_path = getenv("RSB_PLUGINS_CPP_PATH");
if (!plugin_path) { if (!plugin_path) {
#ifdef WIN32 #ifdef WIN32
......
...@@ -76,6 +76,9 @@ IPAACA_EXPORT std::string __ipaaca_static_option_default_payload_type("JSON"); ...@@ -76,6 +76,9 @@ IPAACA_EXPORT std::string __ipaaca_static_option_default_payload_type("JSON");
IPAACA_EXPORT std::string __ipaaca_static_option_default_channel("default"); IPAACA_EXPORT std::string __ipaaca_static_option_default_channel("default");
IPAACA_EXPORT unsigned int __ipaaca_static_option_log_level(IPAACA_LOG_LEVEL_WARNING); IPAACA_EXPORT unsigned int __ipaaca_static_option_log_level(IPAACA_LOG_LEVEL_WARNING);
IPAACA_EXPORT std::string __ipaaca_static_option_rsb_host("");
IPAACA_EXPORT std::string __ipaaca_static_option_rsb_port("");
} // of namespace ipaaca } // of namespace ipaaca
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment