Page MenuHomePhabricator

D5429.id17712.diff
No OneTemporary

D5429.id17712.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 initialization();
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 initialization() {
+ 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
Thu, Nov 28, 2:23 PM (5 h, 38 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2594196
Default Alt Text
D5429.id17712.diff (2 KB)

Event Timeline