From d648dbe9d3b7799beb1172a6396262aee1d8c0af Mon Sep 17 00:00:00 2001 From: Mathias Kraus Date: Fri, 10 Jan 2025 18:29:47 +0100 Subject: [PATCH 1/2] iox-#846 Make default config file location configurable --- .../cmake/IceoryxPlatformDeployment.cmake | 5 +++++ .../freertos/cmake/platform_settings.hpp.in | 1 + .../linux/cmake/IceoryxPlatformDeployment.cmake | 5 +++++ .../linux/cmake/platform_settings.hpp.in | 1 + .../mac/cmake/IceoryxPlatformDeployment.cmake | 5 +++++ .../mac/cmake/platform_settings.hpp.in | 1 + .../qnx/cmake/IceoryxPlatformDeployment.cmake | 5 +++++ .../qnx/cmake/platform_settings.hpp.in | 1 + .../unix/cmake/IceoryxPlatformDeployment.cmake | 5 +++++ .../unix/cmake/platform_settings.hpp.in | 1 + .../win/cmake/IceoryxPlatformDeployment.cmake | 5 +++++ .../win/cmake/platform_settings.hpp.in | 1 + .../roudi/roudi_config_toml_file_provider.hpp | 2 +- .../roudi/roudi_config_toml_file_provider.cpp | 15 ++++++++++++++- 14 files changed, 51 insertions(+), 2 deletions(-) diff --git a/iceoryx_platform/freertos/cmake/IceoryxPlatformDeployment.cmake b/iceoryx_platform/freertos/cmake/IceoryxPlatformDeployment.cmake index 2269926447..0512124a18 100644 --- a/iceoryx_platform/freertos/cmake/IceoryxPlatformDeployment.cmake +++ b/iceoryx_platform/freertos/cmake/IceoryxPlatformDeployment.cmake @@ -34,6 +34,11 @@ configure_option( DEFAULT_VALUE "/tmp/" ) +configure_option( + NAME IOX_PLATFORM_DEFAULT_CONFIG_LOCATION + DEFAULT_VALUE "/etc/" +) + option(IOX_PLATFORM_FEATURE_ACL "Use ACLs for access control" OFF) message(STATUS "[i] IOX_PLATFORM_FEATURE_ACL: ${IOX_PLATFORM_FEATURE_ACL}") diff --git a/iceoryx_platform/freertos/cmake/platform_settings.hpp.in b/iceoryx_platform/freertos/cmake/platform_settings.hpp.in index 8e061b1502..ac23f7aff0 100644 --- a/iceoryx_platform/freertos/cmake/platform_settings.hpp.in +++ b/iceoryx_platform/freertos/cmake/platform_settings.hpp.in @@ -52,6 +52,7 @@ constexpr uint64_t IOX_UDS_SOCKET_MAX_MESSAGE_SIZE = 1024; constexpr const char IOX_UDS_SOCKET_PATH_PREFIX[] = "@IOX_PLATFORM_UDS_SOCKET_PATH_PREFIX@"; constexpr const char IOX_LOCK_FILE_PATH_PREFIX[] = "@IOX_PLATFORM_LOCK_FILE_PATH_PREFIX@"; constexpr const char IOX_TEMP_DIR[] = "@IOX_PLATFORM_TEMP_DIR@"; +constexpr const char IOX_DEFAULT_CONFIG_LOCATION[] = "@IOX_PLATFORM_DEFAULT_CONFIG_LOCATION@"; constexpr uint64_t MAX_USER_NAME_LENGTH = 32; constexpr uint64_t MAX_GROUP_NAME_LENGTH = 16; diff --git a/iceoryx_platform/linux/cmake/IceoryxPlatformDeployment.cmake b/iceoryx_platform/linux/cmake/IceoryxPlatformDeployment.cmake index 703ec07e86..21604ee239 100644 --- a/iceoryx_platform/linux/cmake/IceoryxPlatformDeployment.cmake +++ b/iceoryx_platform/linux/cmake/IceoryxPlatformDeployment.cmake @@ -34,6 +34,11 @@ configure_option( DEFAULT_VALUE "/tmp/" ) +configure_option( + NAME IOX_PLATFORM_DEFAULT_CONFIG_LOCATION + DEFAULT_VALUE "/etc/" +) + option(IOX_PLATFORM_FEATURE_ACL "Use ACLs for access control" ON) message(STATUS "[i] IOX_PLATFORM_FEATURE_ACL: ${IOX_PLATFORM_FEATURE_ACL}") diff --git a/iceoryx_platform/linux/cmake/platform_settings.hpp.in b/iceoryx_platform/linux/cmake/platform_settings.hpp.in index 04f1a4bca5..700039a3b5 100644 --- a/iceoryx_platform/linux/cmake/platform_settings.hpp.in +++ b/iceoryx_platform/linux/cmake/platform_settings.hpp.in @@ -44,6 +44,7 @@ constexpr uint64_t IOX_UDS_SOCKET_MAX_MESSAGE_SIZE = 4096; constexpr const char IOX_UDS_SOCKET_PATH_PREFIX[] = "@IOX_PLATFORM_UDS_SOCKET_PATH_PREFIX@"; constexpr const char IOX_LOCK_FILE_PATH_PREFIX[] = "@IOX_PLATFORM_LOCK_FILE_PATH_PREFIX@"; constexpr const char IOX_TEMP_DIR[] = "@IOX_PLATFORM_TEMP_DIR@"; +constexpr const char IOX_DEFAULT_CONFIG_LOCATION[] = "@IOX_PLATFORM_DEFAULT_CONFIG_LOCATION@"; constexpr uint64_t MAX_USER_NAME_LENGTH = 32; constexpr uint64_t MAX_GROUP_NAME_LENGTH = 32; diff --git a/iceoryx_platform/mac/cmake/IceoryxPlatformDeployment.cmake b/iceoryx_platform/mac/cmake/IceoryxPlatformDeployment.cmake index 2269926447..0512124a18 100644 --- a/iceoryx_platform/mac/cmake/IceoryxPlatformDeployment.cmake +++ b/iceoryx_platform/mac/cmake/IceoryxPlatformDeployment.cmake @@ -34,6 +34,11 @@ configure_option( DEFAULT_VALUE "/tmp/" ) +configure_option( + NAME IOX_PLATFORM_DEFAULT_CONFIG_LOCATION + DEFAULT_VALUE "/etc/" +) + option(IOX_PLATFORM_FEATURE_ACL "Use ACLs for access control" OFF) message(STATUS "[i] IOX_PLATFORM_FEATURE_ACL: ${IOX_PLATFORM_FEATURE_ACL}") diff --git a/iceoryx_platform/mac/cmake/platform_settings.hpp.in b/iceoryx_platform/mac/cmake/platform_settings.hpp.in index 3cd40c27a4..cc8fe67a75 100644 --- a/iceoryx_platform/mac/cmake/platform_settings.hpp.in +++ b/iceoryx_platform/mac/cmake/platform_settings.hpp.in @@ -45,6 +45,7 @@ constexpr uint64_t IOX_UDS_SOCKET_MAX_MESSAGE_SIZE = 2048; constexpr const char IOX_UDS_SOCKET_PATH_PREFIX[] = "@IOX_PLATFORM_UDS_SOCKET_PATH_PREFIX@"; constexpr const char IOX_LOCK_FILE_PATH_PREFIX[] = "@IOX_PLATFORM_LOCK_FILE_PATH_PREFIX@"; constexpr const char IOX_TEMP_DIR[] = "@IOX_PLATFORM_TEMP_DIR@"; +constexpr const char IOX_DEFAULT_CONFIG_LOCATION[] = "@IOX_PLATFORM_DEFAULT_CONFIG_LOCATION@"; constexpr uint64_t MAX_USER_NAME_LENGTH = 32; constexpr uint64_t MAX_GROUP_NAME_LENGTH = 16; diff --git a/iceoryx_platform/qnx/cmake/IceoryxPlatformDeployment.cmake b/iceoryx_platform/qnx/cmake/IceoryxPlatformDeployment.cmake index e47bba68fa..1a53d9a1ff 100644 --- a/iceoryx_platform/qnx/cmake/IceoryxPlatformDeployment.cmake +++ b/iceoryx_platform/qnx/cmake/IceoryxPlatformDeployment.cmake @@ -34,6 +34,11 @@ configure_option( DEFAULT_VALUE "/tmp/" ) +configure_option( + NAME IOX_PLATFORM_DEFAULT_CONFIG_LOCATION + DEFAULT_VALUE "/etc/" +) + option(IOX_PLATFORM_FEATURE_ACL "Use ACLs for access control" ON) message(STATUS "[i] IOX_PLATFORM_FEATURE_ACL: ${IOX_PLATFORM_FEATURE_ACL}") diff --git a/iceoryx_platform/qnx/cmake/platform_settings.hpp.in b/iceoryx_platform/qnx/cmake/platform_settings.hpp.in index 9d4ca5ee0d..1fd735b198 100644 --- a/iceoryx_platform/qnx/cmake/platform_settings.hpp.in +++ b/iceoryx_platform/qnx/cmake/platform_settings.hpp.in @@ -43,6 +43,7 @@ constexpr uint64_t IOX_UDS_SOCKET_MAX_MESSAGE_SIZE = 2048; constexpr const char IOX_UDS_SOCKET_PATH_PREFIX[] = "@IOX_PLATFORM_UDS_SOCKET_PATH_PREFIX@"; constexpr const char IOX_LOCK_FILE_PATH_PREFIX[] = "@IOX_PLATFORM_LOCK_FILE_PATH_PREFIX@"; constexpr const char IOX_TEMP_DIR[] = "@IOX_PLATFORM_TEMP_DIR@"; +constexpr const char IOX_DEFAULT_CONFIG_LOCATION[] = "@IOX_PLATFORM_DEFAULT_CONFIG_LOCATION@"; constexpr uint64_t MAX_USER_NAME_LENGTH = 32; constexpr uint64_t MAX_GROUP_NAME_LENGTH = 16; diff --git a/iceoryx_platform/unix/cmake/IceoryxPlatformDeployment.cmake b/iceoryx_platform/unix/cmake/IceoryxPlatformDeployment.cmake index 2269926447..0512124a18 100644 --- a/iceoryx_platform/unix/cmake/IceoryxPlatformDeployment.cmake +++ b/iceoryx_platform/unix/cmake/IceoryxPlatformDeployment.cmake @@ -34,6 +34,11 @@ configure_option( DEFAULT_VALUE "/tmp/" ) +configure_option( + NAME IOX_PLATFORM_DEFAULT_CONFIG_LOCATION + DEFAULT_VALUE "/etc/" +) + option(IOX_PLATFORM_FEATURE_ACL "Use ACLs for access control" OFF) message(STATUS "[i] IOX_PLATFORM_FEATURE_ACL: ${IOX_PLATFORM_FEATURE_ACL}") diff --git a/iceoryx_platform/unix/cmake/platform_settings.hpp.in b/iceoryx_platform/unix/cmake/platform_settings.hpp.in index d002394be9..7f51c7ccd9 100644 --- a/iceoryx_platform/unix/cmake/platform_settings.hpp.in +++ b/iceoryx_platform/unix/cmake/platform_settings.hpp.in @@ -44,6 +44,7 @@ constexpr uint64_t IOX_UDS_SOCKET_MAX_MESSAGE_SIZE = 1024; constexpr const char IOX_UDS_SOCKET_PATH_PREFIX[] = "@IOX_PLATFORM_UDS_SOCKET_PATH_PREFIX@"; constexpr const char IOX_LOCK_FILE_PATH_PREFIX[] = "@IOX_PLATFORM_LOCK_FILE_PATH_PREFIX@"; constexpr const char IOX_TEMP_DIR[] = "@IOX_PLATFORM_TEMP_DIR@"; +constexpr const char IOX_DEFAULT_CONFIG_LOCATION[] = "@IOX_PLATFORM_DEFAULT_CONFIG_LOCATION@"; constexpr uint64_t MAX_USER_NAME_LENGTH = 32; constexpr uint64_t MAX_GROUP_NAME_LENGTH = 16; diff --git a/iceoryx_platform/win/cmake/IceoryxPlatformDeployment.cmake b/iceoryx_platform/win/cmake/IceoryxPlatformDeployment.cmake index 963774e9b7..20eb1974e1 100644 --- a/iceoryx_platform/win/cmake/IceoryxPlatformDeployment.cmake +++ b/iceoryx_platform/win/cmake/IceoryxPlatformDeployment.cmake @@ -35,6 +35,11 @@ configure_option( DEFAULT_VALUE "" ) +configure_option( + NAME IOX_PLATFORM_DEFAULT_CONFIG_LOCATION + DEFAULT_VALUE "C:/ProgramData/" +) + option(IOX_PLATFORM_FEATURE_ACL "Use ACLs for access control" OFF) message(STATUS "[i] IOX_PLATFORM_FEATURE_ACL: ${IOX_PLATFORM_FEATURE_ACL}") diff --git a/iceoryx_platform/win/cmake/platform_settings.hpp.in b/iceoryx_platform/win/cmake/platform_settings.hpp.in index d9742acb21..8cdf86fbfc 100644 --- a/iceoryx_platform/win/cmake/platform_settings.hpp.in +++ b/iceoryx_platform/win/cmake/platform_settings.hpp.in @@ -44,6 +44,7 @@ constexpr uint64_t IOX_UDS_SOCKET_MAX_MESSAGE_SIZE = 1024U; constexpr const char IOX_UDS_SOCKET_PATH_PREFIX[] = "@IOX_PLATFORM_UDS_SOCKET_PATH_PREFIX@"; constexpr const char IOX_LOCK_FILE_PATH_PREFIX[] = "@IOX_PLATFORM_LOCK_FILE_PATH_PREFIX@"; constexpr const char IOX_TEMP_DIR[] = "@IOX_PLATFORM_TEMP_DIR@"; +constexpr const char IOX_DEFAULT_CONFIG_LOCATION[] = "@IOX_PLATFORM_DEFAULT_CONFIG_LOCATION@"; constexpr uint64_t IOX_MAX_FILENAME_LENGTH = 128U; constexpr uint64_t IOX_MAX_PATH_LENGTH = 255U; diff --git a/iceoryx_posh/include/iceoryx_posh/roudi/roudi_config_toml_file_provider.hpp b/iceoryx_posh/include/iceoryx_posh/roudi/roudi_config_toml_file_provider.hpp index e5c5a1c374..c9021fdc6a 100644 --- a/iceoryx_posh/include/iceoryx_posh/roudi/roudi_config_toml_file_provider.hpp +++ b/iceoryx_posh/include/iceoryx_posh/roudi/roudi_config_toml_file_provider.hpp @@ -26,7 +26,7 @@ namespace iox { namespace config { -static constexpr char defaultConfigFilePath[] = "/etc/iceoryx/roudi_config.toml"; +static constexpr char defaultConfigFileRelativePath[] = "iceoryx/roudi_config.toml"; class TomlRouDiConfigFileProvider : public iox::roudi::RouDiConfigFileProvider { diff --git a/iceoryx_posh/source/roudi/roudi_config_toml_file_provider.cpp b/iceoryx_posh/source/roudi/roudi_config_toml_file_provider.cpp index 74897d1178..510028d617 100644 --- a/iceoryx_posh/source/roudi/roudi_config_toml_file_provider.cpp +++ b/iceoryx_posh/source/roudi/roudi_config_toml_file_provider.cpp @@ -18,6 +18,7 @@ #include "iceoryx_posh/roudi/roudi_config_toml_file_provider.hpp" #include "iceoryx_platform/getopt.hpp" +#include "iceoryx_platform/platform_settings.hpp" #include "iox/file_reader.hpp" #include "iox/into.hpp" #include "iox/logging.hpp" @@ -43,11 +44,23 @@ TomlRouDiConfigFileProvider::TomlRouDiConfigFileProvider(config::CmdLineArgs_t& m_roudiConfig = cmdLineArgs.roudiConfig; if (cmdLineArgs.configFilePath.empty()) { + auto defaultConfigFilePath = + std::string(platform::IOX_DEFAULT_CONFIG_LOCATION) + defaultConfigFileRelativePath; + FileReader configFile(defaultConfigFilePath, "", FileReader::ErrorMode::Ignore); if (configFile.isOpen()) { IOX_LOG(Info, "No config file provided. Using '" << defaultConfigFilePath << "'"); - m_customConfigFilePath = defaultConfigFilePath; + into>(defaultConfigFilePath) + .and_then([&](const auto& path) { m_customConfigFilePath = path; }) + .or_else([&] { + IOX_LOG(Info, + "The config file path is too long. Only " + << roudi::ConfigFilePathString_t::capacity() + << " characters are allowed but the provided path has " + << defaultConfigFilePath.length() << " characters: '" << defaultConfigFilePath + << "'"); + }); } else { From 5cd467c854f996ba5ddacfbeefd963242408c7bc Mon Sep 17 00:00:00 2001 From: Mathias Kraus Date: Fri, 10 Jan 2025 19:58:50 +0100 Subject: [PATCH 2/2] iox-#846 Update release notes --- doc/website/release-notes/iceoryx-unreleased.md | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/website/release-notes/iceoryx-unreleased.md b/doc/website/release-notes/iceoryx-unreleased.md index 25d25dce90..13a3b11c48 100644 --- a/doc/website/release-notes/iceoryx-unreleased.md +++ b/doc/website/release-notes/iceoryx-unreleased.md @@ -237,6 +237,7 @@ - Fix new clang-tidy-18 warnings [#2274](https://github.com/eclipse-iceoryx/iceoryx/issues/2274) - Mistype in readme file [#2384](https://github.com/eclipse-iceoryx/iceoryx/issues/2384) - Typo in architecture.md [#2390](https://github.com/eclipse-iceoryx/iceoryx/issues/2390) +- Make platform paths like config location configurable via cmake [#846](https://github.com/eclipse-iceoryx/iceoryx/issues/846) **Workflow:**