Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F33268744
D5122.1768632542.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D5122.1768632542.diff
View Options
diff --git a/services/tunnelbroker/src/args.h b/services/tunnelbroker/src/args.h
new file mode 100644
--- /dev/null
+++ b/services/tunnelbroker/src/args.h
@@ -0,0 +1,9 @@
+#pragma once
+
+namespace comm {
+namespace tunnelbroker {
+
+void parseArgs(int, char **);
+
+} // namespace tunnelbroker
+} // namespace comm
diff --git a/services/tunnelbroker/src/args.cpp b/services/tunnelbroker/src/args.cpp
new file mode 100644
--- /dev/null
+++ b/services/tunnelbroker/src/args.cpp
@@ -0,0 +1,31 @@
+#include "args.h"
+
+#include <boost/program_options.hpp>
+#include <iostream>
+
+namespace po = boost::program_options;
+
+namespace comm {
+namespace tunnelbroker {
+
+void parseArgs(int argc, char *argv[]) {
+ try {
+ po::options_description desc("Tunnelbroker options");
+ desc.add_options()("help,h", "Produce help message");
+
+ po::variables_map vm;
+ po::store(po::parse_command_line(argc, argv, desc), vm);
+ po::notify(vm);
+
+ if (vm.count("help")) {
+ std::cout << desc << "\n";
+ std::exit(1);
+ }
+ } catch (std::exception &e) {
+ std::cerr << "error: " << e.what() << "\n";
+ std::exit(1);
+ }
+}
+
+} // namespace tunnelbroker
+} // namespace comm
diff --git a/services/tunnelbroker/src/server.cpp b/services/tunnelbroker/src/server.cpp
--- a/services/tunnelbroker/src/server.cpp
+++ b/services/tunnelbroker/src/server.cpp
@@ -2,6 +2,7 @@
#include "ConfigManager.h"
#include "GlobalTools.h"
#include "TunnelbrokerServiceImpl.h"
+#include "args.h"
#include "GlobalConstants.h"
@@ -35,6 +36,7 @@
} // namespace comm
int main(int argc, char **argv) {
+ comm::tunnelbroker::parseArgs(argc, argv);
comm::network::tools::InitLogging("tunnelbroker");
comm::network::config::ConfigManager::getInstance().load();
comm::network::AmqpManager::getInstance().init();
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Jan 17, 6:49 AM (14 h, 53 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5947345
Default Alt Text
D5122.1768632542.diff (1 KB)
Attached To
Mode
D5122: [Services] Allow for tunnelbroker to receive command-line args
Attached
Detach File
Event Timeline
Log In to Comment