Page MenuHomePhabricator

D5429.id18104.diff
No OneTemporary

D5429.id18104.diff

diff --git a/services/tunnelbroker/src/libcpp/Tunnelbroker.h b/services/tunnelbroker/src/libcpp/Tunnelbroker.h
new file mode 100644
--- /dev/null
+++ b/services/tunnelbroker/src/libcpp/Tunnelbroker.h
@@ -0,0 +1,5 @@
+#pragma once
+
+#include "rust/cxx.h"
+
+void initialize();
diff --git a/services/tunnelbroker/src/libcpp/Tunnelbroker.cpp b/services/tunnelbroker/src/libcpp/Tunnelbroker.cpp
new file mode 100644
--- /dev/null
+++ b/services/tunnelbroker/src/libcpp/Tunnelbroker.cpp
@@ -0,0 +1,37 @@
+#include "Tunnelbroker.h"
+#include "AmqpManager.h"
+#include "AwsTools.h"
+#include "ConfigManager.h"
+#include "DatabaseManager.h"
+#include "GlobalTools.h"
+#include "Tools.h"
+
+#include "rust/cxx.h"
+
+void initialize() {
+ comm::network::tools::InitLogging("tunnelbroker");
+ comm::network::config::ConfigManager::getInstance().load();
+ Aws::InitAPI({});
+ // List of AWS DynamoDB tables to check if they are created and can be
+ // accessed before any AWS API methods
+ const std::list<std::string> tablesList = {
+ comm::network::config::ConfigManager::getInstance().getParameter(
+ comm::network::config::ConfigManager::OPTION_DYNAMODB_SESSIONS_TABLE),
+ comm::network::config::ConfigManager::getInstance().getParameter(
+ comm::network::config::ConfigManager::
+ OPTION_DYNAMODB_SESSIONS_VERIFICATION_TABLE),
+ comm::network::config::ConfigManager::getInstance().getParameter(
+ comm::network::config::ConfigManager::
+ OPTION_DYNAMODB_SESSIONS_PUBLIC_KEY_TABLE),
+ comm::network::config::ConfigManager::getInstance().getParameter(
+ comm::network::config::ConfigManager::
+ OPTION_DYNAMODB_MESSAGES_TABLE)};
+ for (const std::string &table : tablesList) {
+ if (!comm::network::database::DatabaseManager::getInstance()
+ .isTableAvailable(table)) {
+ throw std::runtime_error(
+ "Error: AWS DynamoDB table '" + table + "' is not available");
+ }
+ };
+ comm::network::AmqpManager::getInstance().init();
+}

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 25, 3:57 PM (20 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2579903
Default Alt Text
D5429.id18104.diff (2 KB)

Event Timeline