martinzink commented on code in PR #1993:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1993#discussion_r2306885774


##########
minifi_main/MainHelper.h:
##########
@@ -42,29 +40,60 @@ extern "C" {
 #define STOP_WAIT_TIME_MS 30*1000
 //! Default YAML location
 
-//! Define home environment variable
-#define MINIFI_HOME_ENV_KEY "MINIFI_HOME"
-
 #ifdef _MSC_VER
 #ifndef PATH_MAX
 #define PATH_MAX 260
 #endif
 #endif
 
-/**
- * Validates a MINIFI_HOME value.
- * @param home_path
- * @return true if home_path represents a valid MINIFI_HOME
- */
-bool validHome(const std::string &home_path);
+struct Locations {
+  std::filesystem::path working_dir_;
+  std::filesystem::path lock_path_;
+  std::filesystem::path log_properties_path_;
+  std::filesystem::path uid_properties_path_;
+  std::filesystem::path properties_path_;
+  std::filesystem::path logs_dir_;
+  std::filesystem::path fips_bin_path_;
+  std::filesystem::path fips_conf_path_;
+};
 
 /**
  * Configures the logger to log everything to syslog/Windows Event Log, and 
for the minimum log level to INFO
  */
 void setSyslogLogger();
 
-/**
- * Determines the full path of MINIFI_HOME
- * @return MINIFI_HOME on success, empty string on failure
- */
 std::filesystem::path determineMinifiHome(const 
std::shared_ptr<org::apache::nifi::minifi::core::logging::Logger>& logger);
+
+std::optional<Locations> determineLocations(const 
std::shared_ptr<org::apache::nifi::minifi::core::logging::Logger>& logger);
+
+template <>
+struct fmt::formatter<Locations> {
+  constexpr auto parse(format_parse_context& ctx) -> 
format_parse_context::iterator {
+    return ctx.begin();
+  }
+
+  // Format the Locations object
+  template <typename Context>
+  auto format(const Locations& loc, Context& ctx) const -> decltype(ctx.out()) 
{
+    constexpr std::string_view fmt_str =
+        "\n"
+        "{:<24} {}\n"
+        "{:<24} {}\n"
+        "{:<24} {}\n"
+        "{:<24} {}\n"
+        "{:<24} {}\n"
+        "{:<24} {}\n"
+        "{:<24} {}\n"
+        "{:<24} {}";
+
+    return fmt::format_to(ctx.out(), fmt_str,
+                          "Working dir:",         loc.working_dir_,
+                          "Lock path:",           loc.lock_path_,
+                          "Log properties path:", loc.log_properties_path_,
+                          "UID properties path:", loc.uid_properties_path_,
+                          "Properties path:",     loc.properties_path_,
+                          "Logs dir:",            loc.logs_dir_,
+                          "Fips binary path:",    loc.fips_bin_path_,
+                          "Fips conf path:",      loc.fips_conf_path_);
+  }
+};

Review Comment:
   good idea 👍  
https://github.com/apache/nifi-minifi-cpp/pull/1993/commits/786fa3aebef8f854f9429092f04a5c3806498e71#diff-8e10ec79071fe6ce56fe1de81816e96365e9be4f61741a975a0902eb60d7724bR70-R80
 thanks



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to