diff --git a/ReleaseNotes.md b/ReleaseNotes.md index 9be5086a..fafd4680 100644 --- a/ReleaseNotes.md +++ b/ReleaseNotes.md @@ -13,6 +13,7 @@ Added: every DDS module logs now its pid, group id and parent pid. (GH-403) Added: Support for Task Assets. (GH-406) Added: Cancel running and pending SLURM jobs on DDS shutdown. (GH-429) Added: Support for Apple's arm64 architecture. (GH-393) +Added: $DDS_CONFIG and "/etc/dds/DDS.cfg" are added to the DDS config search paths. (GH-458) ### dds-agent Fixed: Address potential crash in the external process termination routines. diff --git a/dds-misc-lib/src/SSHConfigFile.cpp b/dds-misc-lib/src/SSHConfigFile.cpp index 3068fe31..5929021a 100644 --- a/dds-misc-lib/src/SSHConfigFile.cpp +++ b/dds-misc-lib/src/SSHConfigFile.cpp @@ -4,9 +4,9 @@ // //============================================================================= // std +#include #include #include -#include // boost #include // Misc diff --git a/dds-user-defaults/src/UserDefaults.cpp b/dds-user-defaults/src/UserDefaults.cpp index 8ecd99f8..7e463218 100644 --- a/dds-user-defaults/src/UserDefaults.cpp +++ b/dds-user-defaults/src/UserDefaults.cpp @@ -329,7 +329,8 @@ const SDDSUserDefaultsOptions_t CUserDefaults::getOptions() const string CUserDefaults::currentUDFile() { CFindCfgFile cfg; - cfg.SetOrder("$HOME/.DDS/DDS.cfg")("$DDS_LOCATION/etc/DDS.cfg")("$DDS_LOCATION/DDS.cfg"); + cfg.SetOrder("$DDS_CONFIG")("$HOME/.DDS/DDS.cfg")("$DDS_LOCATION/etc/DDS.cfg")("$DDS_LOCATION/DDS.cfg")( + "/etc/dds/DDS.cfg"); string val; cfg.GetCfg(&val); diff --git a/dds-user-defaults/tests/test.cpp b/dds-user-defaults/tests/test.cpp index 896ff5a5..012cc9be 100644 --- a/dds-user-defaults/tests/test.cpp +++ b/dds-user-defaults/tests/test.cpp @@ -4,12 +4,15 @@ // STD #include // BOOST +#include #include // DDS +#include "MiscUtils.h" #include "UserDefaults.h" using namespace std; using namespace dds::user_defaults_api; +namespace fs = boost::filesystem; BOOST_AUTO_TEST_SUITE(Test_UserDefaults); @@ -59,4 +62,23 @@ BOOST_AUTO_TEST_CASE(Test_UserDefaults_DefaultSID_FromSIDFile) }*/ } +BOOST_AUTO_TEST_CASE(Test_UserDefaults_CustomCfgPath) +{ + fs::path pathCfg{ fs::temp_directory_path() / fs::unique_path() }; + fs::create_directories(pathCfg); + pathCfg /= "dds_test.cfg"; + + ofstream f(pathCfg.string()); + BOOST_TEST(f.is_open()); + f << "[server]\n" + << "idle_time=10\n"; + f.close(); + + dds::misc::auto_setenv env1("DDS_CONFIG", pathCfg.string()); + CUserDefaults::instance().reinit(boost::uuids::string_generator()(CUserDefaults::instance().getDefaultSID()), + CUserDefaults::instance().currentUDFile()); + fs::remove(pathCfg); + BOOST_TEST(CUserDefaults::instance().getValueForKey("server.idle_time") == "10"); +} + BOOST_AUTO_TEST_SUITE_END();