davsclaus commented on code in PR #27669:
URL: https://github.com/apache/camel/pull/27669#discussion_r4240437086
##########
components/camel-hashicorp-vault/src/main/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultPropertiesFunction.java:
##########
@@ -257,6 +267,26 @@ private String getSecretFromSource(String key, String
subkey, String defaultValu
return returnValue;
}
+ /**
+ * The name of a secret as the refresh task tracks it: engine:secret, or
only the secret for the default secret
+ * engine. A lookup without engine is tracked as a secret of the default
secret engine, which is also how the
+ * refresh task reads a name without engine.
+ */
+ private static String trackedSecretName(String secretEngine, String key) {
+ return secretEngine == null || "secret".equals(secretEngine) ? key :
secretEngine + ":" + key;
+ }
+
+ private void captureVersion(String secretName, VaultResponse rawSecret) {
+ if (rawSecret.getData().get("metadata") instanceof Map<?, ?> metadata
&& metadata.get("version") != null) {
+ try {
+ secretVersions.put(secretName,
Integer.valueOf(metadata.get("version").toString()));
Review Comment:
Edge case: this keeps the version resolved *last*. If the same secret is
resolved again lazily (e.g. a `toD` placeholder) after an update but before the
task's first check, the newer version becomes the baseline and values resolved
earlier stay stale with no reload. Keeping the oldest is safer (worst case one
extra reload):
```suggestion
secretVersions.merge(secretName,
Integer.valueOf(metadata.get("version").toString()), Math::min);
```
--
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]