Page MenuHomePhabricator

D4841.diff
No OneTemporary

D4841.diff

diff --git a/services/tunnelbroker/src/Constants.h b/services/tunnelbroker/src/Constants.h
--- a/services/tunnelbroker/src/Constants.h
+++ b/services/tunnelbroker/src/Constants.h
@@ -48,10 +48,12 @@
"}$");
// Config
-const std::string CONFIG_FILE_PATH =
- std::string(std::getenv("HOME")) + "/tunnelbroker/tunnelbroker.ini";
-const std::string DEV_CONFIG_FILE_PATH =
- std::string(std::getenv("HOME")) + "/tunnelbroker/tunnelbroker-dev.ini";
+const std::string CONFIG_FILE_DIRECTORY_ENV_VARIABLE =
+ "TUNNELBROKER_CONFIG_FILE_DIRECTORY";
+const std::string DEFAULT_CONFIG_FILE_DIRECTORY =
+ std::string(std::getenv("HOME")) + "/tunnelbroker";
+const std::string CONFIG_FILE_NAME = "tunnelbroker.ini";
+const std::string SANDBOX_CONFIG_FILE_NAME = "tunnelbroker-sandbox.ini";
// DeliveryBroker
const size_t DELIVERY_BROKER_MAX_QUEUE_SIZE = 100;
diff --git a/services/tunnelbroker/src/Tools/ConfigManager.cpp b/services/tunnelbroker/src/Tools/ConfigManager.cpp
--- a/services/tunnelbroker/src/Tools/ConfigManager.cpp
+++ b/services/tunnelbroker/src/Tools/ConfigManager.cpp
@@ -30,10 +30,17 @@
}
void ConfigManager::load() {
+ char const *configFileDirectoryFromEnvironment =
+ std::getenv(CONFIG_FILE_DIRECTORY_ENV_VARIABLE.c_str());
+ std::string configFilePath = DEFAULT_CONFIG_FILE_DIRECTORY;
+
+ if (configFileDirectoryFromEnvironment != nullptr) {
+ configFilePath = std::string{configFileDirectoryFromEnvironment};
+ }
if (comm::network::tools::isSandbox()) {
- loadConfigFile(comm::network::DEV_CONFIG_FILE_PATH);
+ loadConfigFile(configFilePath + "/" + SANDBOX_CONFIG_FILE_NAME);
} else {
- loadConfigFile(comm::network::CONFIG_FILE_PATH);
+ loadConfigFile(configFilePath + "/" + CONFIG_FILE_NAME);
}
}
diff --git a/services/tunnelbroker/tunnelbroker-dev.ini b/services/tunnelbroker/tunnelbroker-sandbox.ini
rename from services/tunnelbroker/tunnelbroker-dev.ini
rename to services/tunnelbroker/tunnelbroker-sandbox.ini

File Metadata

Mime Type
text/plain
Expires
Wed, Jan 8, 5:01 PM (4 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2820633
Default Alt Text
D4841.diff (1 KB)

Event Timeline