zwoop commented on code in PR #12917:
URL: https://github.com/apache/trafficserver/pull/12917#discussion_r2898950529
##########
include/records/RecCore.h:
##########
@@ -69,9 +71,32 @@ std::string RecConfigReadConfigPath(const char
*file_variable, const char *defau
// Return a copy of the persistent stats file. This is
$RUNTIMEDIR/records.snap.
std::string RecConfigReadPersistentStatsPath();
-// Test whether the named configuration value is overridden by an environment
variable. Return either
-// the overridden value, or the original value. Caller MUST NOT free the
result.
-const char *RecConfigOverrideFromEnvironment(const char *name, const char
*value);
+/// Indicates why RecConfigOverrideFromEnvironment() chose its returned value.
+enum class RecConfigOverrideSource {
+ NONE, ///< No override — the original value was kept.
+ ENV, ///< Overridden by a PROXY_CONFIG_* environment variable.
+ RUNROOT, ///< Overridden with the resolved Layout path because runroot
manages this record.
+};
+
+/// Human-readable label for the override source (for logging).
+constexpr const char *
+RecConfigOverrideSourceName(RecConfigOverrideSource src)
+{
+ switch (src) {
+ case RecConfigOverrideSource::ENV:
+ return "environment variable";
+ case RecConfigOverrideSource::RUNROOT:
+ return "runroot";
+ default:
+ return "none";
Review Comment:
Can this happen? Should it be an assert ? Alternatively, instead of a
default:, why not have NONE as the label, future proofing this?
--
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]