Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3700776
D4841.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D4841.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D4841: [services] Tunnelbroker - Add the ability to change the default config files directory to run in Nix
Attached
Detach File
Event Timeline
Log In to Comment